Jump to content

naihr

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

naihr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thank you for your help... but we really have to concatenate the itemid and description because it is the desire output of the end user.... pls help... the first image is the dropdown list i made.. the second image is the viewing area which contains null value on the itemid and description field... (note: the values that i concatenate is from the item_table and i used this values for the entry form of the incoming_table and will be saved to the incoming_table),,.......
  2. Hi? im just a beginner in php i just want to ask how to insert a data into a table from a dropdown list. I have concatenate the itemid and description to form the dropdown list. But when i viewed my item_table the itemid and description columns are null. can you help me with this.. this is my php code for the dropdown list... <?php $query = "SELECT CONCAT(itemid,' ', '-',' ', description) AS Item FROM item_table"; $result = mysql_query($query) or die(mysql_error()); $dropdown = "<SELECT CONCAT(itemid,' ' '-',' ', description) AS Item FROM item_table>"; while($row = mysql_fetch_assoc($result)) { $dropdown .= "\r\n<option value='{$row['Item']}'>{$row['Item']}</option>"; } $dropdown .= "\r\n</select>"; echo $dropdown; ?> this my code for inserting data into the item_table... <?php if(isset($_POST ['submit'])) { $itemid = $_POST['itemid']; $description = $_POST['description']; $datein = $_POST['datein']; $qtyin = $_POST['qtyin']; $unitprice = $_POST['unitprice']; $unit = $_POST['unit']; $category = $_POST['category']; $empid = $_POST['empid']; $message =''; if(($itemid && $description == "")||($itemid && $description == null)) { header("location:IncomingEntry.php?msg=Incorrect"); exit(); } else { $link = mysql_connect('localhost', 'root', '') or die(mysql_error()); $db_selected = mysql_select_db('inventory', $link); $message=''; $query = "INSERT INTO incoming_table (itemid , description, datein, qtyin, unitprice, unit, category, empid) VALUES ('".$itemid."', '".$description."', '".$datein."', '".$qtyin."', '".$unitprice."', '".$unit."', '".$category."', '".$empid."')"; if (!mysql_query($query,$link)) { die('Error: ' . mysql_error()); } header("location: IncomingEntry.php?msg=1 record added"); } } ?> :'(
×
×
  • 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.