Jump to content


Photo

Call to a web page based on Select statement


  • Please log in to reply
No replies to this topic

#1 judikrd

judikrd
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 21 June 2006 - 05:06 AM

Hi...I'm fairly new to PHP and don't understand why sometimes I have access to a $_POST variable, and sometimes not. Here's my specific question:

I'd like my web page to call another page after the user has chosen an item from a SELECT statement. Here's what I've got:

<form name="select" method="post">
<select name="groupChoice" id="groupChoice">
<?php for ($j=1; $j<=$i; $j++) {
echo '<option value =', $keyn[$j], '>', $selectGr[$j], '</option>';
} ?>
</select> <br>
<p><a href="combSelect.php?keyn=<?php echo $_POST['groupChoice'] ?>">Click here to buy </a>

But when a user clicks on the HREF link, there's a blank where the result of <?php echo $_POST['groupChoice'] ?> should be.

So I'm thinking that I need to use a Submit button for the $_POST variable to get a value, right? I tried using onclick="document.location = 'combSelect2.php?keyn=<?php echo $_POST['groupChoice'] ?>' " instead, but the page never went to a new page...

How can I send the user to the correct web page based on their choice in the Select?

Thanks so much for any insights you can give me!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users