Page 1 of 1

Using a returned value for another search

Posted: Wed Mar 14, 2007 9:04 am
by PastorHank
I may not be phrasing this correctly, so please forgive me.

I have a form which shows the results of a search. That form is working correctly and all fields are filled in properly, now what I want to do is permit the visitor to click on a 'submit' button next to one of the fields on the form and have the program pull in the data from the field and have the form open in a new browser window.

here is my php code

Code: Select all

echo "<form  action='pedigrees.php' method=post>"; 
echo "<table align='center' border='0'>";
echo "<tr>\n
	 <td align='center'><B>Animal ID</b></td>
	</tr>";
echo "<tr>\n
	 <td align='left' bgcolor='#FFFFFF' input type='text' name='d' >$animalid</td>
	</tr>";
echo "<tr>\n
	<td align='center'> <input type=submit value=Pedigree> </td>
	</tr>";
echo "</table>\n";
echo "</form>";
The new page show up but with no values. What have I messed up in my code?

Thank you

Posted: Wed Mar 14, 2007 9:11 am
by feyd
The code posted only has a submit button. The input tag's attributes are mixed into a table cell.

Posted: Wed Mar 14, 2007 9:16 am
by PastorHank
I'm confused...(which really isn't that unusual), since I want to pass the value that is in the cell, where do I put the code to accomplish that?

thanks

Posted: Wed Mar 14, 2007 9:32 am
by feyd
Depending on how you want it to look/act

Code: Select all

echo <<<STOP
<form  action="pedigrees.php" method="post">
	<table align="center" border="0">
		<tr>
			<td align="center"><B>Animal ID</b></td>
		</tr>
		<tr>
			<td align="left" bgcolor="#FFFFFF"><input type="text" name="d" value="$animalid" /></td>
		</tr>
		<tr>
			<td align="center"> <input type="submit" value="Pedigree"> </td>
		</tr>
	</table>
</form>
STOP;

// or

echo <<<STOP
<form  action="pedigrees.php" method="post">
	<table align="center" border="0">
		<tr>
			<td align="center"><B>Animal ID</b></td>
		</tr>
		<tr>
			<td align="left" bgcolor="#FFFFFF"><input type="hidden" name="d" value="$animalid" />$animalid</td>
		</tr>
		<tr>
			<td align="center"> <input type="submit" value="Pedigree"> </td>
		</tr>
	</table>
</form>
STOP;

Posted: Wed Mar 14, 2007 9:33 am
by PastorHank
Thank you. I appreciate the help.