stockychaser
-
Posts
8 -
Joined
-
Last visited
Never
Posts posted by stockychaser
-
-
I want the result of the code below, so that the dropdown menu is alphabetically ordened..
<label> <select name="StuffCategory" id="StuffCategory" class="validate[required]" style="width: 350px;"> <option value="">Select Stuff Category...</option> <?php while($obj_queryStuffCategory = mysql_fetch_object($result_queryStuffCategory)) { ?> <option value="<?php echo $obj_queryStuffCategory->StuffCatID;?>" <?php if($obj_queryStuffCategory->StuffCatID == $dataAd[stuffCategory]) { echo 'selected="selected"'; } ?> > <?php echo $obj_queryStuffCategory->StuffCategory;?></option> <?php } ?> </select> </label>
-
Hi Flolan...
you are right.. that is exactly what I need !
I will look into that and see if I can make this work.
thanks for the tip !
-
Hi All,
I have 2 tables:
one
CarMake
- CarMakeID
- CarMakeDesc
two
CarModel
- CarModelID
- CarModelMake
- CarModelDesc
Depending on what the user selects in the first dropdown (carmake)
the possible selection in the second dropdown (model) needs to be limited to only the models from the selected carmake.
in the second table (Carmodel : the 'CarModelMake' = CarMakeID, to identify the make)
How do I limit the dropdown 'CarModel' based on the selected CarMake in the first dropdown.
link : http://98.131.37.90/postCar.php
code :
-- -- --
<label> <select name="carmake" id="CarMake" class="validate[required]" style="width: 200px;"> <option value="">Select CAR MAKE...</option> <?php while($obj_queryCarMake = mysql_fetch_object($result_queryCarMake)) { ?> <option value="<?php echo $obj_queryCarMake->CarMakeID;?>" <?php if($obj_queryCarMake->CarMakeID == $CarAdCarMake) { echo 'selected="selected"'; } ?> > <?php echo $obj_queryCarMake->CarMakeDesc;?></option> <?php } ?> </select> </label> <label> <select name="carmodel" id="CarModel" class="validate[required]" style="width: 200px;"> <option value="">Select MODEL...</option> <?php while($obj_queryCarModel = mysql_fetch_object($result_queryCarModel)) { ?> <option value="<?php echo $obj_queryCarModel->CarModelID;?>" <?php if($obj_queryCarModel->CarmodelID == $CarAdCarModel) { echo 'selected="selected"'; } ?> > <?php echo $obj_queryCarModel->CarModelDesc;?></option> <?php } ?> </select> </label>
I'm a novice.. and appreciates all the help !
-
It's working. .
at the top of the page... I forgot to put in the "getCarCategory" section
<?php
// start session
session_start();
// Include site's config
include_once 'phpcodes/config.php';
// Include connection
include_once 'phpcodes/conn.php';
// get Currency
$sql_queryCurrency = 'SELECT * FROM Currency';
$result_queryCurrency = mysql_query($sql_queryCurrency) or die (mysql_error());
// get CarMake
$sql_queryCarMake = 'SELECT * FROM CarMake';
$result_queryCarMake = mysql_query($sql_queryCarMake) or die (mysql_error());
// get CarCategory
$sql_queryCarCategory = 'SELECT * FROM CarCategory';
$result_queryCarCategory = mysql_query($sql_queryCarCategory) or die (mysql_error());
// get CarModel
$sql_queryCarModel = 'SELECT * FROM CarModel';
$result_queryCarModel = mysql_query($sql_queryCarModel) or die (mysql_error());
?>
thanks for all the help...
-
hi Fergal,
the connection looks like this :
<?php
// information about Mysql server
$dbhost = '98.130.0.104';
$dbuser = 'soundfa_sam';
$dbpass = '********'; //here sits the correct password !
$dbname = 'soundfa_acn';
// try to connect
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error());
// choose database
mysql_select_db($dbname);
?>
- - - - -
When I insert the php string you gave me above, the page no longer loads.
is this normal ? (again... I'm totally new to PHP !! (sorry))
thanks all !
-
oh I'm very sorry... I changed the page, thinking it would work if only 1 drop-down menu was on there, however...that did not change anything.
please look again...
http://98.131.37.90/postPart.php
the second drop-down does work !
-
trying to get a drop-down menu (in a form) to work that needs to get populated from a table
table called : CarCategory
in this table are 2 columns called
CarCategoryID (unique number from 1-18)
CarCategoryDesc (actual name of category.. e.g. 'convertible')
link : http://98.131.37.90/postPart.php
I'm a total novice.. and can't figure out why the first is not working and the second (country) is working
code :
<!--NOT WORKING ... why not ?? should show drop down menu-->
<label>
<div align="center">
<select name="carcategory" id="CarCategory" class="validate[required]" style="width: 200px;">
<option value="">Select Car Category from list...</option>
<?php while($obj_queryCarCategory = mysql_fetch_object($result_queryCarCategory)) { ?>
<option value="<?php echo $obj_queryCarCategory->CarCategoryID;?>"
<?php if($obj_queryCarCategory->CarCategoryID == $UserCountry) { echo 'selected="selected"'; } ?> >
<?php echo $obj_queryCarCategory->CarCategoryDesc;?></option>
<?php } ?>
</select>
</div>
</label>
<!-- working ! -->
<label>
<div align="center">
<select name="country" id="Country" class="validate[required]" style="width: 200px;">
<option value="">Select...</option>
<?php while($obj_queryCountry = mysql_fetch_object($result_queryCountry)) { ?>
<option value="<?php echo $obj_queryCountry->CountryID;?>"
<?php if($obj_queryCountry->CountryID == $UserCountry) { echo 'selected="selected"'; } ?> >
<?php echo $obj_queryCountry->CountryName;?></option>
<?php } ?>
</select>
</div>
</label>
how to 'orden' dropdown menu alphabetically
in PHP Coding Help
Posted
being a total novice.. where exactly do I put this ?