Jump to content

Record edit page and radio buttons


liquinas

Recommended Posts

I have a form to edit items from the database it consists of admin.php which puts in values from the database to be displayed in form fields. Then there is process.php which redisplays the form if user left something empty but uses $_POST variables to redisplay what the user just entered instead displaying from database.

 

Sample of field "Color" from form:

 

<input name=\"Color\" type=\"text\" size=\"30\" maxlength=\"10\" value=\"{$carinfo ['Color']}\"/>

That works just fine.

 

On the same page I have fields to select a path for pictures. But with radio buttons. It goes as so:

 <tr>
        <td width=\"13%\"><input name=\"Pic_1\" type=\"radio\" value=\"nopic2.jpg\"/></td>
        <td width=\"87%\">Use default system image </td>
      </tr>
      <tr>
        <td><input name=\"Pic_1\" type=\"radio\" value=\"pictures/{$carinfo ['ID']}_p_1.jpg\" /></td>
        <td>Use image file: /pictures/{$carinfo ['ID']}_p_1.jpg</td>
      </tr>

For all intended purposes it works, except when the user forgets to input something above, like Color, then all radio buttons switch to blank on the re-display of the form.

 

Any way around this?

Link to comment
https://forums.phpfreaks.com/topic/40360-record-edit-page-and-radio-buttons/
Share on other sites

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.