DontheCat Posted September 13, 2005 Share Posted September 13, 2005 I have this Select option in my form -------------------------------------------------------------------------------- [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]<select name=\"revdist_ID\"> [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]do { [/span][span style=\"color:#0000BB\"]?> [/span] <option value=\"[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$row_Rev_Dists[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'revdist_ID\'[/span][span style=\"color:#007700\"]][/span][span style=\"color:#0000BB\"]?>[/span]\">[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$row_Rev_Dists[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'revdistrict\'[/span][span style=\"color:#007700\"]][/span][span style=\"color:#0000BB\"]?>[/span]</option> [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]} while ([/span][span style=\"color:#0000BB\"]$row_Rev_Dists [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_assoc[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$Rev_Dists[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#0000BB\"]$rows [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_num_rows[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$Rev_Dists[/span][span style=\"color:#007700\"]); if([/span][span style=\"color:#0000BB\"]$rows [/span][span style=\"color:#007700\"]> [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]) { [/span][span style=\"color:#0000BB\"]mysql_data_seek[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$Rev_Dists[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$row_Rev_Dists [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_assoc[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$Rev_Dists[/span][span style=\"color:#007700\"]); } [/span][span style=\"color:#0000BB\"]?> [/span] </select>[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] -------------------------------------------------------------------------------- The code returns and datalogs the revdist_ID perfectly. I'd also like to have the revdistrict corresponding to the selected revdist_ID in a HIDDEN field. How would I be able to do it? Thanks for the support Quote Link to comment Share on other sites More sharing options...
Mattyspatty Posted September 15, 2005 Share Posted September 15, 2005 [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo[/span][span style=\"color:#DD0000\"]\"<input type=\'hidden\' name=\'myhidden\' value=$revdist_ID>\"[/span][span style=\"color:#007700\"];[/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Quote Link to comment Share on other sites More sharing options...
DontheCat Posted September 15, 2005 Author Share Posted September 15, 2005 [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\\\"color:#0000BB\\\"]<?php [/span][span style=\\\"color:#007700\\\"]echo[/span][span style=\\\"color:#DD0000\\\"]\\\"<input type=\'hidden\' name=\'myhidden\' value=$revdist_ID>\\\"[/span][span style=\\\"color:#007700\\\"];[/span][span style=\\\"color:#0000BB\\\"]?>[/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] 295592[/snapback] Thanks Matty, but will your code not return the revdist_ID again? I wanted the corresponding revdistrict to be returned in the Hidden field. Thanks for the support. Quote Link to comment Share on other sites More sharing options...
Mattyspatty Posted September 21, 2005 Share Posted September 21, 2005 Thanks Matty, but will your code not return the revdist_ID again? I wanted the corresponding revdistrict to be returned in the Hidden field. Thanks for the support. 295595[/snapback] what do u want the data in the hidden field to a variable? $_POST['hiddenfieldname'] or $_GET if u used get on ur form Quote Link to comment Share on other sites More sharing options...
DontheCat Posted September 21, 2005 Author Share Posted September 21, 2005 I use POST in the form. I tried something like this to return the revdistrict from the revdist_ID posted by the form. [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]<input type=\'hidden\' name=\'district\' value=\"[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$row_Rev_Dists[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'revdistrict\'[/span][span style=\"color:#007700\"]][/span][span style=\"color:#0000BB\"]?>[/span]\">[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]revdist_ID[/span][span style=\"color:#007700\"]];[/span][span style=\"color:#0000BB\"]?>[/span]>[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Nothing happens and I dont even get an error message !! Quote Link to comment Share on other sites More sharing options...
ryanlwh Posted September 21, 2005 Share Posted September 21, 2005 I use POST in the form. I tried something like this to return the revdistrict from the revdist_ID posted by the form. [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]<input type=\'hidden\' name=\'district\' value=\\\"[span style=\\\"color:#0000BB\\\"]<?php [/span][span style=\\\"color:#007700\\\"]echo [/span][span style=\\\"color:#0000BB\\\"]$row_Rev_Dists[/span][span style=\\\"color:#007700\\\"][[/span][span style=\\\"color:#DD0000\\\"]\'revdistrict\'[/span][span style=\\\"color:#007700\\\"]][/span][span style=\\\"color:#0000BB\\\"]?>[/span]\\\">[span style=\\\"color:#0000BB\\\"]<?php [/span][span style=\\\"color:#007700\\\"]echo [/span][span style=\\\"color:#0000BB\\\"]$POST[/span][span style=\\\"color:#007700\\\"][[/span][span style=\\\"color:#0000BB\\\"]revdist_ID[/span][span style=\\\"color:#007700\\\"]];[/span][span style=\\\"color:#0000BB\\\"]?>[/span]>[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Nothing happens and I dont even get an error message !! 297692[/snapback] [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<? $_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'revdist_ID\'[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]?>[/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.