logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 12-12-2011, 03:56 PM   #1
shoapin
 
Join Date: Dec 2011
Posts: 4
Default Search and Advanced Result Page

Can someone please help me?

I have a search page with two list menu and two radio buttons.
The user of the site can select from the list/menu car, jeep, motocycle and
The two radio buttons have sale or rent
When the submit button is pressed i need check if jeep is selected search the correct database or if jeep and sale are selected, search the correct database and put it on a seperate results page.

I am very new to php, and the if statements and while statements are killing me, i have searched and searched for help but no one seems to know how to submit this multiple parameter form.

Thanks in adavance
shoapin is offline   Reply With Quote
Old 12-12-2011, 05:44 PM   #2
shoapin
 
Join Date: Dec 2011
Posts: 4
Default

Here is html, i'm lost on the PHP

<form id="searcMennuu" name="searcMennuu" method="post" action="VehicleListing.php">
<select name="vehicles" id="vehicles">
<option value="allCars" selected="selected">ALL</option>
<option value="Sedan">Sedan</option>
<option value="Jeep">Jeep</option>
<option value="Motorbike">Motorbike</option>

</select>

<input name="radioVehicle" type="radio" id="searchSale" value="searchSale" />
Vehicles for Sale</label>
<label>
<input type="radio" name="radioVehicle" id="searchRent" value="searchRent" />
Vehicles for Rent</label>

<input type="submit" name="searchButton" id="searchButton" value="Search" />
</form>
shoapin is offline   Reply With Quote
Old 12-13-2011, 01:17 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

well if you save the above (as a test) as something.php it will submit to itself as i changed the action. All values are submited.

Code:
<form id="searcMennuu" name="searcMennuu" method="post" action="">
<select name="vehicles" id="vehicles">
<option value="allCars" selected="selected">ALL</option>
<option value="Sedan">Sedan</option>
<option value="Jeep">Jeep</option>
<option value="Motorbike">Motorbike</option>

</select>

<input name="radioVehicle" type="radio" id="searchSale" value="searchSale" />
Vehicles for Sale</label>
<label>
<input type="radio" name="radioVehicle" id="searchRent" value="searchRent" />
Vehicles for Rent</label>

<input type="submit" name="searchButton" id="searchButton" value="Search" />
</form>


<?php foreach($_POST as $var => $value)
{
echo $var . ' : ' . $value . "<br>";
}
?>
so what do you want to do with them?
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is online now   Reply With Quote
Old 12-13-2011, 01:29 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

sorry just read your post more carefully
Quote:
When the submit button is pressed i need check if jeep is selected search the correct database or if jeep and sale are selected, search the correct database and put it on a separate results page.
you need to write a select statement like this

Code:
$vehicle= $_POST['vehicle']
$sale= $_POST['radioVehicle']

// this will simplify the Post array

// edit to your table and field names

select * from table where vehicle= $vehicle AND sale=$sale

this is just basic and values must match values in your database.
You may enter a problem if the radio buttons are not selected so you could make one default
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is online now   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:17 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com