Forum Moderators: coopster
brief description of what I am trying to achieve;
1. Click dropdown list
2. Select a [card_number] from list
3. Have the corresponding [id] assigned to a variable $myvariable
4. Use that variable in Query "SELECT date, amount FROM spending WHERE card_number = ('$myvariable')"
5. Display the results in a table in the same page
I'm struggling with the syntax (and more!)
I have a dropdown list that offers a choice of card_numbers (card_1, card_2, card_3, card_4)
<?
$query="SELECT id,card_number FROM card_number";
$result = mysql_query ($query);
echo "<select name='car'>
<option value=''>Select One</option>";
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[id]>$nt[card_number]</option>";
}
echo "</select>";
?>
Questions;
How do I save the user choice corresponding [id] to $myvariable?
What is the correct method of reloading the page to display the result of the Query
(I would rather just reload the page at this stage in my learning)
Thanks anyone for any advice you are able to give.