Page 1 of 1

$_POST Value not being passed - SOLVED

Posted: Tue May 08, 2007 2:58 pm
by PastorHank
The code from my selection form is

Code: Select all

if (mysql_num_rows($result1) > 0) {

			echo "<form action='embryoedit.php' method=post>"; 	
			echo "<select name='sirelist' size='10'>";

		 	while ($row = mysql_fetch_array($result1)) {	
			 extract($row);
		 	 
			  	 echo "<option value=\"".htmlspecialchars($amimalid)."\">$animalid";	
		}
				echo "</select>";	
				echo "<input type=submit value=submit>";
				echo "</form>"; 
		}
		else
		{
				$nothingfound="No Inventory Listed";
		echo "<h1 align='center'>$nothingfound</h1>";
		}
The form fills correctly with values and after I select the value I want and go to embryoedit.php

The code from embryoedit.php is

Code: Select all

$sire_to_use = $_POST['sirelist'];
Var_Dump() shows $sire_to_use to be an empty strings.


Thank you

Posted: Tue May 08, 2007 3:06 pm
by guitarlvr
Not sure if this will fix it but you might try putting double quotes " around post.

Code: Select all

echo '<form action="embryoedit.php" method="post">';
Wayne

Posted: Tue May 08, 2007 3:12 pm
by PastorHank
No, that didn't change things.

Posted: Tue May 08, 2007 4:06 pm
by RobertGonzalez
Post the HTML for the form.

Posted: Tue May 08, 2007 4:09 pm
by John Cartwright

Code: Select all

echo '<pre>';
print_r($_POST);
echo '</pre>';

would be helpful aswell

Posted: Tue May 08, 2007 4:57 pm
by PastorHank
<pre>
Returned this

Array
(
[sirelist] =>
)

I'm not sure how much of the HTML you want, the only thing that exists
is

Code: Select all

<html>

<head> <title> Bloodlines of the Legends - Embryo Inventory Maintenance </title> </head>
<body bgcolor="#DEB887">
and then the php starts
I create a table for my top graphics

Code: Select all

echo "<table align='center' border='2' width='400' bgcolor='#800000' bordercolor='#000000'>";
	echo  "<tr>\n
				<td>
		<img border='0' src='../images/logo.gif' width='400' height='72' style='border: 0px ridge #800000;
 padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px'>
				</td>
		</tr>";
	echo "</table>\n";

		$animaltype="List Of Available Embryos - By Sire";

	 	echo "<h1 align='center'>$animaltype</h1>";

		if (mysql_num_rows($result1) > 0) {

			echo '<form action="embryoedit.php" method="post">'; 	
			echo '<select name="sirelist" size="10">';

		 	while ($row = mysql_fetch_array($result1)) {	
			 extract($row);
		 	 
			  	 echo "<option value=$amimalid>$animalid";	
		}
				echo "</select>";	
				echo "<input type=submit value=submit>";
				echo "</form>"; 
		}
		else
		{
				$nothingfound="No Inventory Listed";
		echo "<h1 align='center'>$nothingfound</h1>";
		}

?>

</body></html>


Posted: Tue May 08, 2007 4:58 pm
by PastorHank
I found it. I had mispelled animal.....

thanks for the suggestions