slashpine Posted January 2, 2007 Share Posted January 2, 2007 I know this is a basic question but for some reason I am having a memory lapse (CRS)how can I pass a [i]value option[/i] from a drop down menu to the form actioni.e., /path/action.php?query=[i]value option[/i]TIA Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/ Share on other sites More sharing options...
AndyB Posted January 2, 2007 Share Posted January 2, 2007 Javascript is how you can modify the form action value ... which rather begs the question why do you want to modify it when you can use what's passed by the form naturally into the $_GET or $_POST array depending on the form's method. Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151173 Share on other sites More sharing options...
slashpine Posted January 2, 2007 Author Share Posted January 2, 2007 The form uses _POST but I can't get it to select the option value from a drop down menu or text box Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151208 Share on other sites More sharing options...
Jessica Posted January 2, 2007 Share Posted January 2, 2007 The suggestion was simply have the same action page and use POST to determine what to do, instead of having different action pages. Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151285 Share on other sites More sharing options...
PFMaBiSmAd Posted January 2, 2007 Share Posted January 2, 2007 To get specific help with why your form and/or form processing code is not working you would need to post them. Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151407 Share on other sites More sharing options...
slashpine Posted January 2, 2007 Author Share Posted January 2, 2007 hypothetically, if I have a script that executes using a variable %$query%how do I pass a "value option" from a drop down menu or a text box on an HTML form to the script?i.e., how do I make the form submit the selected or entered value option as %$query% ? Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151545 Share on other sites More sharing options...
Jessica Posted January 2, 2007 Share Posted January 2, 2007 Can you post some code? Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151571 Share on other sites More sharing options...
slashpine Posted January 2, 2007 Author Share Posted January 2, 2007 I don't really have any code...I saw a script that I may be able to use.the script executes on a variable that is called by " %$query% "I am wanting to change the sql query in the script to match my tables but I need to be able to use a couple of different html forms and I can't recall how to pass an option value(drop down menu) or an entered value(text box) to the action script as " %$query% "hope you can help... Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-151623 Share on other sites More sharing options...
slashpine Posted January 3, 2007 Author Share Posted January 3, 2007 I am still seeking help with this if anyone can oblige....TIA Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-152437 Share on other sites More sharing options...
Carterhost Posted January 3, 2007 Share Posted January 3, 2007 [quote]/path/action.php?query=value option[/quote]if you really want to do it that way, use the $_GET form method, and name your input "query". in it's simplest form:[code]<form action="action.php" method="GET"><input name="query" type="text" /><input name="submit" action="submit" value="submit" /></form>[/code]Whatever you select in your input will be passed across in the URL. Or am I getting the wrong end of the stick? Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-152484 Share on other sites More sharing options...
Jessica Posted January 3, 2007 Share Posted January 3, 2007 Sounds right to me Carter. Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-152552 Share on other sites More sharing options...
slashpine Posted January 4, 2007 Author Share Posted January 4, 2007 Thanks for the time... is there no way to use _POST rather than _GET ? Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-152684 Share on other sites More sharing options...
Carterhost Posted January 4, 2007 Share Posted January 4, 2007 Yes, you could, but you really seem to want the variables passed in the URL...? Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-152863 Share on other sites More sharing options...
slashpine Posted January 4, 2007 Author Share Posted January 4, 2007 not passed to a url...to the action file Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-153016 Share on other sites More sharing options...
trq Posted January 4, 2007 Share Posted January 4, 2007 [quote]is there no way to use _POST rather than _GET[/quote]Take a look at [url=http://php.net/curl]curl[/url]. Quote Link to comment https://forums.phpfreaks.com/topic/32515-pass-variable-to-script-action/#findComment-153017 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.