$_POST Value not being passed - SOLVED

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

$_POST Value not being passed - SOLVED

Post 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
Last edited by PastorHank on Tue May 08, 2007 4:59 pm, edited 1 time in total.
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Post 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
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post by PastorHank »

No, that didn't change things.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Post the HTML for the form.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

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

would be helpful aswell
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post 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>

PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post by PastorHank »

I found it. I had mispelled animal.....

thanks for the suggestions
Post Reply