OK This is stressing me out...
- Started
- Last post
- 3 Responses
- londonBoy
I have this form in html with an input field called "search_terms". When you click on submit, I then want to use PHP to grab the value of "search_terms" and assign it to a new variable.
In my PHP i've used this to create the variable:
$keyword = $search_terms;but it doesn't work.
PLEASE HELP!!!!!!!!!!Thanx in advance
- jslr0
still early, so I'm not going to be as useful as I might be later, but first thing that comes to mind is:
try to echo $search_terms at the top of yr form-handling script. If it doesn't return anything (which, from the sounds of it, it probably won't), then the problem is with passing the variable from your form to the script. Sure you labeled your field correctly?
- atze1870
problems i quite easy to solve:
since php 4.2.1 you have to query $_POST["search_terms"] or $_GET["search_terms"] (depends on your form method, when having mixed form actions use $_REQUEST["search_terms"], which will query variables retrieved via get, post or sessions), the post and get variables are no "autoglobals" since that version.
i think that should solve your problems.
- londonBoy0
atze187, you are god-like. Thanks jslr too. I'm now using:
$keyword = $_REQUEST["search_terms"];
It works great!