MirageSF
asked on
Loading LIST Menus with data from database
Hi,
<form name="form1" method="post" action="">
<select name="select">
<option value="<?php $selected="domain 1";print mysql_result($result,0,"do main");?>" selected><?php print mysql_result($result,0,"do main");?>< /option>
<option value="<?php $selected="domain 2";print mysql_result($result,1,"do main");?>" ><?php print mysql_result($result,1,"do main");?>< /option>
</select>
<input type="submit" name="Submit" value="SHOW">
</form>
Im using the code above to force 2 rows of data into the list menu, how do I get the list menu to auto populate from the rows in the database ?
When one is actually selected and the Submit button is clicked it also needs to set the $selected variable to the domain name selected.
Thank
<form name="form1" method="post" action="">
<select name="select">
<option value="<?php $selected="domain 1";print mysql_result($result,0,"do
<option value="<?php $selected="domain 2";print mysql_result($result,1,"do
</select>
<input type="submit" name="Submit" value="SHOW">
</form>
Im using the code above to force 2 rows of data into the list menu, how do I get the list menu to auto populate from the rows in the database ?
When one is actually selected and the Submit button is clicked it also needs to set the $selected variable to the domain name selected.
Thank
Below previously asked questions should be very helpful for you:
https://www.experts-exchange.com/questions/20991140/Populating-a-dropdown-box-with-data-from-a-MySQL-table.html
https://www.experts-exchange.com/questions/20821007/Populate-a-combo-drop-box-with-mySql-data.html
https://www.experts-exchange.com/questions/21042723/populating-combo-boxes-with-current-value-selected-then-select-new-val-for-update.html
https://www.experts-exchange.com/questions/20763191/Drop-down-box-PHP-MySQL.html
https://www.experts-exchange.com/questions/20387750/Populating-Select-Box-from-mySQL.html
https://www.experts-exchange.com/questions/20623802/Populate-dropdown-box-with-MySQL.html
https://www.experts-exchange.com/questions/20991140/Populating-a-dropdown-box-with-data-from-a-MySQL-table.html
https://www.experts-exchange.com/questions/20821007/Populate-a-combo-drop-box-with-mySql-data.html
https://www.experts-exchange.com/questions/21042723/populating-combo-boxes-with-current-value-selected-then-select-new-val-for-update.html
https://www.experts-exchange.com/questions/20763191/Drop-down-box-PHP-MySQL.html
https://www.experts-exchange.com/questions/20387750/Populating-Select-Box-from-mySQL.html
https://www.experts-exchange.com/questions/20623802/Populate-dropdown-box-with-MySQL.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sigh, im not having much luck today
you can remove $num = 0; you don't need it.
you can remove $num = 0; you don't need it.
>> When one is actually selected and the Submit button is clicked it also needs to set the $selected variable to the domain name selected.
$selected = $_POST['domain'];
The post value of domain will contain the domain name that was selected in the drop down list
$selected = $_POST['domain'];
The post value of domain will contain the domain name that was selected in the drop down list
ASKER
Hi Diablo84,
I used a slightly smaller piece of code that seems to do the trick nicely, seems its all pretty much working as planned at the moment...
http://www.stormfusion.com/dms.php
L=DMS-001-1000
P=test
Except for the DOMAIN link, it currently links to http://www.stormfusion.com/domainone.com for some reason, it should be http://www.domainone.com. The $domain variable only contains the domainone.com part and not the http://www.
Im using the code as...
<?php echo "<a href='" . mysql_result($result3,0,"d omain") . "'>" . mysql_result($result3,0,"d omain") . "</a>"; ?>
Once this is fixed I will close the question.
Thankyou
I used a slightly smaller piece of code that seems to do the trick nicely, seems its all pretty much working as planned at the moment...
http://www.stormfusion.com/dms.php
L=DMS-001-1000
P=test
Except for the DOMAIN link, it currently links to http://www.stormfusion.com/domainone.com for some reason, it should be http://www.domainone.com. The $domain variable only contains the domainone.com part and not the http://www.
Im using the code as...
<?php echo "<a href='" . mysql_result($result3,0,"d
Once this is fixed I will close the question.
Thankyou
ASKER