Passing value from forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neugent
Forum Newbie
Posts: 24
Joined: Wed Jul 06, 2005 3:35 am
Location: Philippines

Passing value from forms

Post 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.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: Passing value from forms

Post 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.
neugent
Forum Newbie
Posts: 24
Joined: Wed Jul 06, 2005 3:35 am
Location: Philippines

Post by neugent »

Thank you again for the response Burrito, i got it running. :D
Post Reply