Using a returned value for another search

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

Using a returned value for another search

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The code posted only has a submit button. The input tag's attributes are mixed into a table cell.
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

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

Post by PastorHank »

Thank you. I appreciate the help.
Post Reply