Righty ho, read loads of stuff about populating drop downs and wot not, but can't find what i want to do, plus being a php noob, feel a weener asking.....
I've got a drop down, populated from my database, containgin payment types:
Cheque
Credit Card
Debit Card
Invoice
Depeding on the selection made, i want to display different stuff....
This is all held in a big form with a load of other stuff, and i don't want to have to send the user to a diff page with just this bit on in a form of its own.
I think i need something like this:
<my payment option drop down>
<?php
code that populates the select field
$result=mysql_query("SELECT paymentkind FROM payment_info") or die("Nada happening here payment_info....");
// put data into drop-down list box
$option_block_paymentkind = "ad";
while ($row = mysql_fetch_array($result))
{
$i = $row["paymentkind"];
$option_block_paymentkind .= "<OPTION value=\"$i\">$i</OPTION>";
}
echo("<SELECT name=payment_info>$option_block_paymentkind</SELECT>*");
?>
</my payment option dropdown>
<stuff generated/displayed depending on drop down>
if drop down = 'Cheque'
then display this
else if drop down = 'Credit Card'
then display this
else if drop down = 'Debit Card'
then display this
else if drop down = 'Invoice'
then display this
end if
</stuff generated/displayed depending on drop down>
Any ideas?
I'm sure there are a million posts asking this question, i have to admit to only trawling though 18 pages, then searching and finding only a few returns.....containing drop down population