Jump to content

Archived

This topic is now archived and is closed to further replies.

DontheCat

Returning Form Input

Recommended Posts

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

 

 

Share this post


Link to post
Share on other sites

[!--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--]

 

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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 !!

Share this post


Link to post
Share on other sites
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--]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.