Jump to content

why can't I put database values back into a list menu?


vomitbomb

Recommended Posts

I can get the values from the database and put them in the text fields like so, but I can't put values back into the List menus (they all stay the same).

 

//Update order
echo'<form action="order.php" method="post">
         <input type="hidden" name="fname" value="'.$row['fname'].'" />
 <input type="hidden" name="lname" value="'.$row['lname'].'" />
         <input type="hidden" name="lname" value="'.$row['tb24kg'].'" />
 <input type="submit" value="Update-Order" />
     </form>';

 

and then:


<label>First
      <input type="text" name="fname" id="fname" value='<? echo "$fname" ?>' />
      </label>
        <label>Surname
          <input type="text" name="lname" id="lname" value='<? echo "$lname" ?>' />
        </label>
<label>2-4kg
      <select name="tb24kg" size="1" id="tb24kg" value='<? echo "$tb24kg" ?>'>
        <option value="0">0</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
          </select>
      </label>

 

Anyone know why?

I worked out how I could put the values in the list menu like:

<label>60-70
          <select name="wt6070" id="wt6070">
          <option value='<? echo "$wt6070" ?>' selected="selected"><? echo "$wt6070" ?></option>
          <option value="0">0</option>
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
</select>
        </label>

 

Only problem is it seems to have to display a value at the bottom of the list menu.

Say it has selected number 5 because the value of wt6070 is 5, 5 also appears below the 0 in the drop down menu. It's only an aesthetic thing but it's working which is cool.

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.