SVM
SVM

Reputation: 15

editing HTML and PHP

I have an html file which I edited because there was a typo . I tried to make a corresponding change to the .php file but these changes are not getting rid of Undefined Index notice I am getting. If I instead edit the .php file to match the typo in html, the error does not appear. What is going on?

html code:

<dl>
  <dt>Guardian Title</dt>
  <dd>
    <input id="G_Title" name="G_Title" type="text" />
  </dd>
</dl>

php code

$G_Title  =     $_POST['G_title'];

If I change php to G_Title everything is fine but if I change html to G_Title, I still get the error.

Of course, I can see the work around right here, but why does this error come about?

Upvotes: 0

Views: 89

Answers (2)

aimadnet
aimadnet

Reputation: 423

The correct PHP code :

$G_Title  =     $_POST['G_Title'];

To avoid this error in the future, don't use capital letters in your code.

Upvotes: 0

James Donnelly
James Donnelly

Reputation: 128771

Your problem is that you're using G_Title in the HTML and G_title in the PHP. Make sure the case matches on both.

Change your HTML to:

<input id="G_title" name="G_title" type="text" />

Or change your PHP to:

$G_Title  =     $_POST['G_Title'];

Upvotes: 1

Related Questions