Click to See Complete Forum and Search --> : [RESOLVED] Switched from PHP4 to PHP5


tjbarr
09-20-2005, 04:54 PM
Changed form PHP4 to PHP5 - Now I get these errors:

$_POST['submit']
Get the error Undefined Index.

<?=$linkdesc;?>
Get the error Undefined Variable

DoctorWho
09-20-2005, 05:33 PM
Try turning off your Error Notifications in the PHP.ini.

The code should work otherwise.

goldbug
09-20-2005, 05:57 PM
Adjusting your error_reporting level is just a hack--not a solution to the real problem(s).

The first one: it's throwing the error because the "submit" value is not defined in the $_POST array. Either the page was not called via POST, or it's missing from the form. Check for the existence of the variable before attempting to use it. Something like:
if (isset($_POST['submit'])) { /* do stuff */ }

The second error is most likely because the original script relied on register_globals being turned on. See http://www.php.net/register_globals

tjbarr
09-20-2005, 06:23 PM
I had a form that submitted
<form action= "<?php echo $_SERVER['PHP_SELF'];?>" method="POST">

<input name="Submit" type="submit" value="Display by Program">

Now it doesn't submit anything. Do I have to change the form action to a link?

tjbarr
09-23-2005, 03:02 PM
<?php
$_SESSION['visited']= 'y';
}
else
{
$_SESSION = $_POST;
header("Location: displayfed.php");
}
$_SESSION['county2']=$_POST[county2];
$_SESSION['orgfunction']=$_POST[orgfunction];


Used this code to set my Session equal to the select box choice.

robi-bobi
10-17-2005, 12:16 PM
<input name="Submit" type="submit" value="Display by Program">

try with

echo $_POST['Submit']; //case sensitive (you used $_POST['submit'])