Results 1 to 3 of 3

Thread: [RESOLVED] whats wrong with my code

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    30

    Resolved [RESOLVED] whats wrong with my code

    Hi all..may i know what is wrong with my codes..
    I have 2 tables..company(com_id,com_code,com_name) and purchase(po_id,po_no,com_code).Now i want to insert all values.
    There are one drop down combo in my form to display com_name.Now I want to insert value of com_code.Can someone let me know why com_code not saved into my db.

    Here is my codes:
    In form
    PHP Code:
    <td><select name="com_name"> 
                <? 
                    $sqlst = mysql_query("SELECT com_name,com_code FROM company  ORDER BY com_name"); 
                    while($company = mysql_fetch_array($sqlst)){ ?> 
                    <option value="<? echo $company['com_code'] ?>"><? echo $company['com_name'] ?> 
                    </option> 
                    <? } ?> 
                  </select></td>
    In Insert Process
    PHP Code:
    <? 
    include ("../../odbc.php"); 

    echo $po_no=$_POST['po_no']; 
    echo $po_date=$_POST['po_date']; 
    echo $com_name=$_POST['com_name']; 
    echo $com_code=$_POST['com_code'];

    $query_add_data = "INSERT INTO purchase(po_no,po_date,com_code) VALUES ('$po_no','$po_date','$com_code')";
    $result=mysql_query($query_add_data) or die("Could Not Add");

    echo "<META HTTP-EQUIV=Refresh CONTENT=\"5; URL=add_stockin.php\">";

    ?>
    Thanks in advance
    Last edited by saraa; Oct 30th, 2006 at 01:49 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width