Jump to content

pass variable to script action


slashpine

Recommended Posts

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

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%  ?
Link to comment
Share on other sites

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

[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?
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.