www.webdeveloper.com
Results 1 to 2 of 2

Thread: can you help me with my problem plz

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    6

    Angry can you help me with my problem plz

    Hi guys (Again),

    I have tried to figure it out my self before posting (books, google etc) but cant really find anything that helps me;

    What I am trying to do is for the staff to type in a product number text box (number already in database (table 1)) and echo the product description in one box called "product description" another textbox with the price so the form can be posted to the database (table 2) along with the added "Purchase order number, quantity and total"

    but for the life of me i cannot get it to work,

    Heres the PHP please dont laugh at the code as i am still learning PHP:

    PHP Code:
    <?php
        
        
    include ("db.php");
        
        
    $prodsearch1 mysql_real_escape_string($_POST['productcode']);
        
    $prodfind mysql_query("SELECT productdescription FROM products WHERE productcode = '".$prodsearch1."'");
        (
    $row5 mysql_fetch_array($prodfind)); $row5 $row5['productcode']; 
        
       
    ?>
    and the html:

    HTML Code:
    <div class="content" id="addpro">
    <form style="text-align:right"action="saveproduct.php" method="post">
    	<div style="width:400px; text-align:right">
        <div style="margin-left: 48px;">
    	Service Centre: <input name="servicecentre" type="text" />
    	</div>
    	<br />
    	<div style="margin-left: 97px;">
    	PO Number: <input name="ponumber" type="text" />
    	</div>
    	<br />
    	<div style="margin-left: 80px;">
    	Product Code: <input name="productcode" type="text" />
    	</div>
        <br />
    	<div style="margin-left: 80px;">
    	Product Description:  <input name="proddesc" value="<?php echo $row5 ?>"type="text" />
    	</div>
        <br />
    	<div style="margin-left: 80px;">
    	Price:  <input name="price" type="text" />
    	</div>
        <br />
    	<div style="margin-left: 80px;">
    	Quantity: <input name="quantity" type="text" />
    	</div>
        <br />
    	<div style="margin-left: 80px;">
    	Total: <input name="total" type="text" />
    	</div>
    	<div style="margin-left: 127px; margin-top: 14px;"><input name="" type="submit" value="Save" /></div>
    
    </div>
    </form>
    </div>
    Thanks in advanced and for your patience

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    629
    IN your query , you are looking for a specific product code in order to get the product description. But - as soon as you grab the first row of your results you are looking for a non-existent field in that result. If you had turned on php error checking you would have been pointed to that line, since you should have received an error concerning a non-existent index being used on $row5.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles