Jump to content

Can't get my dropdown box to populate correctly


SeanWoods

Recommended Posts

Basically, I will be proofreading/editing people's documents and will charge them per word, and also on how soon they need it completed by.

 

On this page, http://www.grammarperfection.com/cost.html they paste in their document to get a price quote and also select how soon they need it completed by.

 

They can select 3 different options:

 

* Standard - 3 Day/72 Hour Return - $5.00 Per Page

* Expedite - 2 Day/48 Hour Return - $7.50 Per Page

* Overnight - 1 Day/24 Hour Return - $9.00 Per Page

 

 

On this page, http://www.grammarperfection.com/che...v=1&words=1345 they select more related details. This is the page I am having trouble with. I am using php to code the info in the drop down box called "service option," and also to put in the number of words. When you click the arrow in the drop down box for "service option," it shows whatever selection they selected on the previous page twice. In other words, it shows all 3 options, and also whatever option was selected on the previous page will be listed on the top of the 3 possible option. I would like it to show the selected option only once along with the other 2 possible options (with the selected option being the default one chosen).

 

So basically, right now, if someone selects Expedite - 2 Day/48 Hour Return - $7.50 Per Page on the previous page, then on the next checkout page, under the dropdown box, it incorrectly says:

 

Expedite - 2 Day/48 Hour Return - $7.50 Per Page

Standard - 3 Day/72 Hour Return - $5.00 Per Page

Expedite - 2 Day/48 Hour Return - $7.50 Per Page

Overnight - 1 Day/24 Hour Return - $9.00 Per Page

 

Let me know if you see anything to fix this. Keep in mind, web design is very new to me and most of the php code was done by someone who helped me on a html forum so try to explain as if you were to a 2 year old. I won't be offended

 

Here is my php which is causing me problems:

<?

 

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv

$words = $_GET['words']; // as above

 

$servvalue = $serv; // creating a value to go in the drop down box..

 

if($serv == 1)

{

$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";

}

 

 

if($serv == 2)

{

$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";

}

 

 

if($serv == 3)

{

$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";

}

 

?>

 

___________________________________________

 

<select name="select">

<option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>

<option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>

<option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>

<option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>

</select>

 

<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">

I mean something like:

<?
switch ($serv) {
    case 1:
        $select1='selected="selected"';
        break;
    case 2:
        $select2='selected="selected"';
        break;
    case 0:
        $select3='selected="selected"';
        break;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.