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
PastorHank
Forum Contributor
Posts: 117 Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country
Post
by PastorHank » Mon Aug 28, 2006 2:13 pm
In my program this code seems to be working properly
Code: Select all
echo "<form action='pedigree.php' method=post>";
echo "<select name='deerlist'>";
while ($row = mysql_fetch_array($result)) {
extract($row);
echo "<option value='$deerunumber'>$deernumber\n";
}
echo "</select>";
echo "<input type=submit value=submit>";
echo "</form>";
By properly, I mean the list is populated with the right information. In pedigree.php, I have the following code at the top (where I've always put it..)
Code: Select all
$deer_to_use=strip_tags(trim($_POST['deerlist']));
echo 'deer to use is ->'. $deer_to_use;
$deer_to_use is always empty.
Could someone please tell me what I'm overlooking.
Thank you
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Mon Aug 28, 2006 2:17 pm
EDIT | Sorry, I didn't read the post properly. Maybe we can try this.
Code: Select all
<form action="pedigree.php" method="post">
<select name="deerlist">
<?php
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['deerunumber'] . '">' . $row['deernumber'] . '</option>';
}
?>
</select>
<input type="submit" value="submit">
</form>
Then, in your checking page, check isset($_POST['deerlist']) and process from there.
Last edited by
RobertGonzalez on Mon Aug 28, 2006 2:22 pm, edited 2 times in total.
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Mon Aug 28, 2006 2:17 pm
Change this:
Code: Select all
echo "<option value='$deerunumber'>$deernumber\n";
to this:
Code: Select all
echo "<option value='$deernumber'>$deernumber\n";
PastorHank
Forum Contributor
Posts: 117 Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country
Post
by PastorHank » Mon Aug 28, 2006 2:22 pm
Thank you...it was the spelling of deernumber....I've been reading the code for the past 4 hours looking for that...
This forum has saved me hours of pulling out my hair (and since I'm bald anyway...that's quite a blessing..)
Thanks again
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Mon Aug 28, 2006 2:23 pm
EDIT | Removed 'cuz it was silly.