Jump to content

Recommended Posts

I have a PHP script for a contact form that I am using on one webserver, and i copied the scripts and all the subfolders to a new webserver and I am getting an undefined index error in my text fields.

 

It is literally line for line the same code, but I am getting the error on the second webserver.  Could it be a problem with the version of PHP the second webhost is running?

 

the working code can be seen at:

http://www.premiermoviegroup.com/contact/contact_form.php?lid=1

 

the non working code and the error can be seen at:

http://av.premierw.com/contact/contact_form.php?lid=1

 

I have gone through every single line of code, and even resorted to copy and pasting one script into the other and uploading it, and i still get the undefined index error.

 

*confused*

 

is it saying undefined because i haven't run my handle form yet?

 

That is exactly what it is saying. If you wish to fix the errors on your form where you re-populate the fields here is an example of what to use:

 

<input type="text" name="uname" value="<?php echo isset($_POST['uname'])?$_POST['uname']:'';?>" />

 

The ? and : are the Ternary operators. It is basically a short If/Else statement:

 

If uname isset then use that value, else just use a blank value.

 

Hope that helps ya.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.