Hello web developers I'm trying to create option "all models" in auto script. so people could choose for example Honda and would choose "all models" of honda and see the results.
<?php include('head.php'); ?>
<body>
<body id="homepage">
<style type="text/css">
.t{font-weight:bold;color:#000000;width:200px}
select{width:250px}
input{width:238px}
</style>
<div id="container">
<?php include('header.php'); ?>
<?php include('menu.php'); ?>
<?php include('left.php'); ?>
<?php include('reright.php'); ?>
<div id="right">
<h1>Submit Your Auto For Free! Please complete all the fields</h1>
<p>By Submitting your ad you are accepting our <a href="http://www.autoinhouse.net/terms.php"><strong><font color="009900"> Terms </a></strong></p>
<p>
<?php
if(checkLogged() == false) {
print "Please log into your account first, redirecting...";
refreshPage(3, "login.php");
}else{
if(isset($_POST['sb'])) {
extract($_POST);
$errors = array();
foreach ($_POST as $k => $v) {
if(empty($v)) {
$errors[] = "$k - mandatory field";
}
}
$make = intval($make);
$model = intval($model);
$doorsCount = intval($doorsCount);
$makes = buildMakes();
$modelURL = buildModels();
$errorsCount = sizeof($errors);
if($errorsCount != 0) {
foreach ($errors as $v) {
printError($v);
}
}else{
//do the right stuff
$userid = $_SESSION['userID'];
$added = time();
$sql = "insert into `ads` values (null, '".mysql_real_escape_string($make)."', '".mysql_real_escape_string($model)."', '".mysql_real_escape_string($price)."', '".mysql_real_escape_string($bodyStyle)."', '".mysql_real_escape_string($mileAge)."', '".mysql_real_escape_string($extColor)."', '".mysql_real_escape_string($intColor)."', '".mysql_real_escape_string($engine)."', '".mysql_real_escape_string($transmission)."', '".mysql_real_escape_string($doorsCount)."', '".mysql_real_escape_string($fuelType)."', '".mysql_real_escape_string($citystate)."', '".mysql_real_escape_string($contactName)."', '".mysql_real_escape_string($contactNo)."', '$photos', '$userid', '$added', '".mysql_real_escape_string($description)."', '".mysql_real_escape_string($untill)."')";
$rs = mysql_query($sql);
if($rs) {
$photos = "";
//print_r($_FILES);
foreach($_FILES as $keys => $values) {
if ($_FILES[$keys]['name'] != "" && preg_match('/image/', $_FILES[$keys]['type'])) {
$path = "uploadedImages";
$newName = md5(rand(1, 999999)).".".substr($_FILES[$keys]['type'], 6, strlen($_FILES[$keys]['type']));
if(move_uploaded_file($_FILES[$keys]['tmp_name'], "$path/$newName")) {
$photos .= $newName."|";
}
}
}
$photos = rtrim($photos, "|");
if($photos != "") {
printSuccess("Successfully added, redirecting to your AD...");
refreshPage(5, "carads|".mysql_insert_id()."|$makes[$make]|$modelURL[$model].html");
mysql_query("update ads set photos = '$photos' where id = ".mysql_insert_id().""); }else{
printSuccess("Your AD is LIVE, BUT Photos couldn't be added");
}
}else{
printError("Sorry but we eccountered an error while trying to add your car to database");
printError(mysql_error());
}
}
}
?>
<fieldset style="width:450px">
<legend><b style="color: rgb(128, 195, 28);">Fill in the form below </b></legend>
<form action="" method="POST" enctype="multipart/form-data">
<table>
<tr><td class="t">Car Make</td><td>
<select name="make" id="getMake">
<option value="0" selected>- select make</option>
<?php
$buildModels = buildMakes();
foreach ($buildModels as $makeID => $make) {
print "<option value=\"$makeID\">$make</option>\n";
}
unset($buildModels);
?>
</select>
</td></tr>
<tr>
<td class="t">Car Model</td>
<td><select name="model" id="getModel"><option value="0" selected="selected">- select make first</option>
</select></td>
</tr>
<tr>
<td class="t">Fuel Type<td><select name="fuelType">
<?php
foreach ($fuels as $fuel) {
print "<option value=\"$fuel\">".ucfirst($fuel)."</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td class="t">Auto Body Type </td>
<td>
<select name="bodyStyle">
<?php
foreach ($bodyStyles as $fuel) {
print "<option value=\"$fuel\">".ucfirst($fuel)."</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td class="t">Transmission</td><td>
<select name="transmission">
<?php
foreach ($transmissions as $transmission) {
print "<option value=\"$transmission\">".ucfirst($transmission)."</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td class="t">Door Count</td><td>
<select name="doorsCount">
<?php
foreach ($doorsCount as $fuel) {
print "<option value=\"$fuel\">".ucfirst($fuel)."</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td class="t">Mileage</td><td><input type="text" name="mileAge"></td>
</tr>
<tr>
<td class="t">Engine</td><td><input type="text" name="engine"></td>
</tr>
<tr>
<td class="t">Exterior color</td><td><input type="text" name="extColor"></td>
</tr>
<tr>
<td class="t">Interior color</td><td><input type="text" name="intColor"></td>
</tr>
<tr>
<td class="t">Location (City, State)</td><td><input type="text" name="citystate"></td>
</tr>
<tr>
<td class="t">Your Name</td>
<td><input type="text" name="contactName"></td>
</tr>
<tr>
<td class="t">Phone No.</td><td><input type="text" name="contactNo"></td>
</tr>
<tr>
<td class="t">Price (include currency)</td><td><input type="text" name="price"></td>
</tr>
<tr>
<td class="t">AD Untill (month/day/year):</td><td><input type='text' name='untill' value='' /></td>
</tr>
<tr>
<td class="t">Description</td><td><textarea name="description" maxlength="500" style="width:238px;height:100px"></textarea></td>
</tr>
<tr>
<td class="t">Choose up to 4 images</td>
<td><input type="file" name="photos" id="my_file_element"></td>
</tr>
</table>
<input type="submit" name="sb" value="Add my auto" style="margin-left:200px;width:150px;height:28px;">
</form>
<div id="files_list" style="border: 1px solid #cccccc">Image list <br/>
</div>
<script>
var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 4 );
multi_selector.addElement( document.getElementById( 'my_file_element' ) );
</script>
<?php
}
?>
</fieldset>
</p>
</div>
<div style="height:10px;clear:both"></div>
<?php include('footer.php'); ?>
</div><!--container-->
</body>
</html>