Page 1 of 1
Dropdown box--Redirect Help!
Posted: Sat Nov 16, 2002 7:46 pm
by RySk8er30
Hello,
I am new to PHP and need help. If you go to my website...
http://www.pc1staid.net/Ryan.html on the left hand side I have a drop down box with Computer Repair, Computer Sales, Web Design, and Web Hosting. I want a customer to choose one of those services and click the "Go" button next to it and be redirected to the appropriate page. I am not sure how to do so. Can someone give me some code on how to do it? thanks.
Ryan
RySk8er30@Aol.com
Posted: Sat Nov 16, 2002 11:12 pm
by volka
the basic structure that provides the drop-down list and the "go"-button is
Code: Select all
...
<form action="action1.php">
<select name="browse" style="WIDTH: 115px; FONT-FAMILY: verdana">
<option>...</option>
</select>
<input type="image" ...
</select>
not specifying otherwise the form's method is GET.
So action1.php will have access to the parameter via $_GET['browse'] (or simply $browse if register global is enabled, see
Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+)
a redirect with php is performed via
header() function
But note that the whole document will be updated. If you use frames you may add a
target-property to the form-element (see:
http://www.w3.org/TR/html4/interact/forms.html#h-17.3)
e.g.
Code: Select all
<form method="GET" action="action1.php" target="mainFrm">
Still Confused
Posted: Sun Nov 17, 2002 9:17 am
by RySk8er30
Here is my code for form on the webpage (
http://www.pc1staid.net/Ryan.html)
Code: Select all
<form action="action1.php">
<table border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan=2><IMG src="images/browse.jpg"></td></tr>
<tr> <td style="PADDING-LEFT: 20px"> <select name="browse" style="WIDTH: 115px; FONT-FAMILY: verdana">
<option selected> Web Design <option> Computer Repair <option> Computer Sales
<option> Web Hosting</option> </select> </td><td style="PADDING-LEFT: 10px"><input type="image" src="images/go.gif" name="search" ></td></tr>
</table></form>
Can someone write the code for the PHP "action1.php"? I just want it set up so if someone selects web design it will go to design.html, computer repair it will go to repair.html etc.
thanks
Ryan
RySK8er30@Aol.com
Posted: Mon Nov 18, 2002 3:01 am
by twigletmac
If you want someone to write the code for you then you need to post the request in the Job Hunt forum, accordingly I have moved this thread there.
Mac