Jump to content

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

 

 

Link to comment
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--]

 

Link to comment
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.

Link to comment
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

Link to comment
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 !!

Link to comment
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--]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.