PDA

View Full Version : second option wont submit on dropdowns


Superior
06-24-2007, 04:31 PM
Hi friends,

I have watched this vidieo and installed the script without a problem but what I am running into is the second field wont submit calling the products that are related.am I missing something? you can see it on my testing server http://www.superiorkustoms.com/testing it is located just under the header.Any help is greatfully apreciated

Mark_W
06-24-2007, 05:11 PM
You have an error on line 147 of your coding. Looking at the source code just below the drop down values you can see that.

Superior
06-24-2007, 05:16 PM
Hi thx for the qwick reply this is line 147
<?php }while ($rowModel = mysql_fetch_array($result)); ?> in tht case I will post my whole code in the next post

Superior
06-24-2007, 05:17 PM
<?php
require_once("Connections/connection.php"); // database connection
$make = $_POST['make'];

if ($make){
/////////////////////////////////////////////////
$query = sprintf("SELECT * FROM products_description where car_model_id='$make'");
$result = @mysql_query($query);
$rowModel = mysql_fetch_array($result);
/////////////////////////////////////////////////
}
?>



<center><form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<select name="make" onChange="document.forms[0].submit()">
<option value="">Select Make</option>
<option value="1"<?php if(!(strcmp(1, $make))){echo "selected";}?>>Acura</option>
<option value="57"<?php if(!(strcmp(57, $make))){echo "selected";}?>>Alfa</option>
<option value="2"<?php if(!(strcmp(2, $make))){echo "selected";}?>>Audi</option>
<option value="3"<?php if(!(strcmp(3, $make))){echo "selected";}?>>BMW</option>
<option value="28"<?php if(!(strcmp(28, $make))){echo "selected";}?>>Buick</option>
<option value="37"<?php if(!(strcmp(37, $make))){echo "selected";}?>>Buick</option>
<option value="29"<?php if(!(strcmp(29, $make))){echo "selected";}?>>Cadillac</option>
<option value="4"<?php if(!(strcmp(4, $make))){echo "selected";}?>>Chevrolet</option>
<option value="24"<?php if(!(strcmp(24, $make))){echo "selected";}?>>Chrysler</option>
<option value="39"<?php if(!(strcmp(39, $make))){echo "selected";}?>>Daewoo</option>
<option value="46"<?php if(!(strcmp(46, $make))){echo "selected";}?>>DeTomaso</option>
<option value="5"<?php if(!(strcmp(5, $make))){echo "selected";}?>>Dodge</option>
<option value="25"<?php if(!(strcmp(25, $make))){echo "selected";}?>>Eagle</option>
<option value="56"<?php if(!(strcmp(56, $make))){echo "selected";}?>>Ferrari</option>
<option value="47"<?php if(!(strcmp(47, $make))){echo "selected";}?>>Fiat</option>
<option value="6"<?php if(!(strcmp(6, $make))){echo "selected";}?>>Ford</option>
<option value="38"<?php if(!(strcmp(38, $make))){echo "selected";}?>>Geo</option>
<option value="23"<?php if(!(strcmp(23, $make))){echo "selected";}?>>GMC</option>
<option value="7"<?php if(!(strcmp(7, $make))){echo "selected";}?>>Honda</option>
<option value="42"<?php if(!(strcmp(42, $make))){echo "selected";}?>>Hummer</option>
<option value="20"<?php if(!(strcmp(20, $make))){echo "selected";}?>>Hyundai</option>
<option value="8"<?php if(!(strcmp(8, $make))){echo "selected";}?>>Infiniti</option>
<option value="34"<?php if(!(strcmp(34, $make))){echo "selected";}?>>Isuzu</option>
<option value="41"<?php if(!(strcmp(41, $make))){echo "selected";}?>>Jaguar</option>
<option value="21"<?php if(!(strcmp(21, $make))){echo "selected";}?>>Jeep</option>
<option value="40"<?php if(!(strcmp(40, $make))){echo "selected";}?>>Kia</option>
<option value="43"<?php if(!(strcmp(43, $make))){echo "selected";}?>>Lamborgini</option>
<option value="35"<?php if(!(strcmp(35, $make))){echo "selected";}?>>Land Rover</option>
<option value="10"<?php if(!(strcmp(10, $make))){echo "selected";}?>>Lexus</option>
<option value="30"<?php if(!(strcmp(30, $make))){echo "selected";}?>>Lincoln</option>
<option value="48"<?php if(!(strcmp(48, $make))){echo "selected";}?>>Lotus</option>
<option value="11"<?php if(!(strcmp(11, $make))){echo "selected";}?>>Mazda</option>
<option value="12"<?php if(!(strcmp(12, $make))){echo "selected";}?>>Mercedes</option>
<option value="31"<?php if(!(strcmp(31, $make))){echo "selected";}?>>Mercury</option>
<option value="36"<?php if(!(strcmp(36, $make))){echo "selected";}?>>MINI</option>
<option value="13"<?php if(!(strcmp(13, $make))){echo "selected";}?>>Mitsubishi</option>
<option value="14"<?php if(!(strcmp(14, $make))){echo "selected";}?>>Nissan</option>
<option value="28"<?php if(!(strcmp(28, $make))){echo "selected";}?>>Oldsmobile</option>
<option value="49"<?php if(!(strcmp(49, $make))){echo "selected";}?>>Opel</option>
<option value="50"<?php if(!(strcmp(50, $make))){echo "selected";}?>>Peugeot</option>
<option value="32"<?php if(!(strcmp(32, $make))){echo "selected";}?>>Plymouth</option>
<option value="22"<?php if(!(strcmp(22, $make))){echo "selected";}?>>Pontiac</option>
<option value="15"<?php if(!(strcmp(15, $make))){echo "selected";}?>>Porsche</option>
<option value="51"<?php if(!(strcmp(51, $make))){echo "selected";}?>>Proton</option>
<option value="52"<?php if(!(strcmp(52, $make))){echo "selected";}?>>Ranault</option>
<option value="37"<?php if(!(strcmp(37, $make))){echo "selected";}?>>Reatta</option>
<option value="27"<?php if(!(strcmp(27, $make))){echo "selected";}?>>Saab</option>
<option value="26"<?php if(!(strcmp(26, $make))){echo "selected";}?>>Saturn</option>
<option value="44"<?php if(!(strcmp(44, $make))){echo "selected";}?>>Scion</option>
<option value="53"<?php if(!(strcmp(53, $make))){echo "selected";}?>>Seat</option>
<option value="54"<?php if(!(strcmp(54, $make))){echo "selected";}?>>Skoda</option>
<option value="16"<?php if(!(strcmp(16, $make))){echo "selected";}?>>Subaru</option>
<option value="19"<?php if(!(strcmp(19, $make))){echo "selected";}?>>Suzuki</option>
<option value="17"<?php if(!(strcmp(17, $make))){echo "selected";}?>>Toyota</option>
<option value="55"<?php if(!(strcmp(55, $make))){echo "selected";}?>>Vauxhall</option>
<option value="9"<?php if(!(strcmp(9, $make))){echo "selected";}?>>Volkswagen</option>
<option value="18"<?php if(!(strcmp(18, $make))){echo "selected";}?>>Volvo</option>

</select>
<form id="form1" name="form1" method="get" action="<?php $_SERVER['PHP_SELF']; ?>">
<select name="model_id"onChange="document.forms[0].submit()">
<option value="">Select Model</option>
<?php do { ?>
<option value="<?php echo $rowModel['car_model_id']; ?>"><?php echo $rowModel['car_model']; ?></option>
<?php }while ($rowModel = mysql_fetch_array($result)); ?>
</select>

</form>

Superior
06-24-2007, 05:27 PM
This is line 147 <?php }while ($rowModel = mysql_fetch_array($result)); ?>

Superior
06-24-2007, 05:28 PM
sorry for the double post I could not see it so I thought is was not here

davidj
06-24-2007, 06:29 PM
Mmm ... you have named both forms the same although i dont think this is the problem.
so are you saying that the first dropdown doesnt populate the second onchange?

Superior
06-24-2007, 08:39 PM
the first(Make) dropdown does populate the second(model)dropdown but after the model is diplayed and you select it it does not display the results as it should

domedia
06-24-2007, 11:25 PM
you can see it on my testing server http://www.superiorkustoms.com/testing

You have an error on line 147 of your coding. Looking at the source code just below the drop down values you can see that.

Hi thx for the qwick reply this is line 147
<?php }while ($rowModel = mysql_fetch_array($result)); ?> in tht case I will post my whole code in the next post

Mark was talking about the HTML page , we cannot see the php page.
Look at the page you have on the web and try to validate it, and you'll see the errors as well.

Superior
06-24-2007, 11:56 PM
This is what the source code says
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/testing/templates/Original_B2B/header.php</b> on line <b>148</b><br />

Still not sure what it means but overall the the code is working till I get to the last step of submitting and displaying

davidj
06-25-2007, 09:22 AM
you have an onchange event submitting the form again from the second drop down