Jump to content

[SOLVED] PHP and HTML Option


adam391

Recommended Posts

I want to get at the value attribute of a html option.

 

I have the following html

 

<form action="processProduct.php?action=addProduct" method="post" enctype="multipart/form-data" name="frmAddProduct" id="frmAddProduct">

  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">

  <tr><td colspan="2" id="entryTableHeader">Add Product</td></tr>

  <tr>

  <td width="150" class="label">Category</td>

  <td class="content"> <select name="category" id="cboCategory" class="box">

    <option value="" selected>-- Choose Category --</option>

<option value"4">shoes</option><option value"5">Earrings</option><option value"6">Heels</option><option value"7">Boots</option><option value"8">Flats</option><option value"9">Wellies</option><option value"10">Necklaces</option><option value"11">Bracelets</option><option value"12">Homewares</option>

    </select></td>

  </tr>

  <tr>

  <td width="150" class="label">Product Name</td>

  <td class="content"> <input name="txtName" type="text" class="box" id="txtName" size="50" maxlength="100"></td>

  </tr>

  <tr>

  <td width="150" class="label">Description</td>

  <td class="content"> <textarea name="mtxDescription" cols="70" rows="10" class="box" id="mtxDescription"></textarea></td>

  </tr>

  <tr>

  <td width="150" class="label">Price</td>

  <td class="content"><input name="txtPrice" type="text" id="txtPrice" size="10" maxlength="7" class="box" onKeyUp="checkNumber(this);"> </td>

  </tr>

  <tr>

  <td width="150" class="label">Qty In Stock</td>

  <td class="content"><input name="txtQty" type="text" id="txtQty" size="10" maxlength="10" class="box" onKeyUp="checkNumber(this);"> </td>

  </tr>

  <tr>

  <td width="150" class="label">Image</td>

  <td class="content"> <input name="fleImage" type="file" id="fleImage" class="box">

    </td>

  </tr>

</table>

<p align="center">

  <input name="btnAddProduct" type="submit" id="btnAddProduct" value="Add Product" onClick="checkAddProductForm();" class="box">

    <input name="btnCancel" type="button" id="btnCancel" value="Cancel" onClick="window.location.href='index.php';" class="box"> 

</p>

</form>

 

but my php always picks up the option text not the value

 

    $catId      = $_POST['category'];

 

 

Thanks

 

Adam

Link to comment
https://forums.phpfreaks.com/topic/102044-solved-php-and-html-option/
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.