bassdog65 Posted May 8, 2009 Share Posted May 8, 2009 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* Link to comment https://forums.phpfreaks.com/topic/157402-same-code-two-webservers-different-results/ Share on other sites More sharing options...
premiso Posted May 8, 2009 Share Posted May 8, 2009 The second webhost has a higher error_reporting level than does the first. Add this line to the top of your script: <?php error_reporting(E_ALL & ~E_NOTICE); And it will remove the notice errors. Link to comment https://forums.phpfreaks.com/topic/157402-same-code-two-webservers-different-results/#findComment-829785 Share on other sites More sharing options...
bassdog65 Posted May 8, 2009 Author Share Posted May 8, 2009 great! just because i am not seeing the errors doesn't mean they aren't there. is it saying undefined because i haven't run my handle form yet? two solutions from you in one day. much appreciated. Link to comment https://forums.phpfreaks.com/topic/157402-same-code-two-webservers-different-results/#findComment-829787 Share on other sites More sharing options...
premiso Posted May 8, 2009 Share Posted May 8, 2009 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. Link to comment https://forums.phpfreaks.com/topic/157402-same-code-two-webservers-different-results/#findComment-829793 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.