Jump to content


Photo

Returning Form Input


  • Please log in to reply
5 replies to this topic

#1 DontheCat

DontheCat
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 13 September 2005 - 09:57 AM

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



#2 Mattyspatty

Mattyspatty
  • Members
  • PipPipPip
  • Advanced Member
  • 76 posts
  • LocationEngland :D

Posted 15 September 2005 - 09:04 AM

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

ok, so my PHP is a bit rusty... my replies are 90% ok.
the other 10% either have syntax errors or are the "hard solution"
http://www.php.net  http://www.google.com - Are your friends!

I have a C++ problem with 'keybd_event' in certain applications. if you can help me PM me! :P
Needs motivation to create another quick cash website. I need a new TV

#3 DontheCat

DontheCat
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 15 September 2005 - 09:27 AM

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

View Post


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.

#4 Mattyspatty

Mattyspatty
  • Members
  • PipPipPip
  • Advanced Member
  • 76 posts
  • LocationEngland :D

Posted 21 September 2005 - 11:24 AM

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.

View Post



what do u want the data in the hidden field to a variable?

$_POST['hiddenfieldname'] or $_GET if u used get on ur form
ok, so my PHP is a bit rusty... my replies are 90% ok.
the other 10% either have syntax errors or are the "hard solution"
http://www.php.net  http://www.google.com - Are your friends!

I have a C++ problem with 'keybd_event' in certain applications. if you can help me PM me! :P
Needs motivation to create another quick cash website. I need a new TV

#5 DontheCat

DontheCat
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 21 September 2005 - 12:19 PM

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

#6 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 21 September 2005 - 09:31 PM

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

View Post


[!--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--]
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users