Page 1 of 1

Passing value from forms

Posted: Wed Jul 13, 2005 12:22 am
by neugent
I have a search box, and search button which will submit on itself. I want my data to appear on my URL, how can i possibly do that?

Sample Search Entry: EA-1B-N1
Result: http://www.mysite.com/mypage.php?id=erj ... b]EA-1B-N1[/b]

Here's my partial code:

Code: Select all

echo	"<table width=100% align='center'><form name='searchitem' method='post' action='".$PHP_SELF."?id=$getlink&search=."'>
		<tr>
			<td><div align='center'>
			<input name='search' type='text' maxlength='30' class='loginbox'>
			</div></td>
		<tr>
		<tr>
			<td><div align='center'>
			<input name='searchbtn' type='Submit' class='loginbtn' value='Search Item'>
			</div></td>
		</tr></form>
		</table><br>";
What will i add on my search variable?
I tried $_REQUEST['search'], i know im doing this wrong, i just want some advise on how i should go about with this one.

Thank you in advance.

Re: Passing value from forms

Posted: Wed Jul 13, 2005 12:30 am
by Burrito
neugent wrote:I have a search box, and search button which will submit on itself. I want my data to appear on my URL, how can i possibly do that?
change your form method to get.
neugent wrote: What will i add on my search variable?
I tried $_REQUEST['search'], i know im doing this wrong, i just want some advise on how i should go about with this one.

Thank you in advance.
no idea what you're after here...if you mean how do you reference the passed variable, use the $_GET[] array (if you change the method to "get" or the $_POST[] array if you leave it as post.

Posted: Wed Jul 13, 2005 1:23 am
by neugent
Thank you again for the response Burrito, i got it running. :D