Jump to content

Same code, two webservers, different results


bassdog65

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.