Hi

I have code I use to look up data from mysql, then dispaly in text boxes.
For some reason ALL my data drops the words and spaces

Example: if a supplier name is "DyFin (Pty) Ltd" the text box only displayes "DyFin"
Example: If My phone numbers are "0860 555 2350" the text box shows me "0860"

I have messed through my code to get this to work but im lost now:

<select name="select" onChange="window.location='add_doc.php?supplier='+this.value" >
         <?php  

            $its = $_GET["supplier"]; 


            if($its == 0)
                    {

                    $sql="SELECT * FROM supplier"; 
                    $result=mysql_query($sql); 

                    $options=""; 

                    echo "<OPTION VALUE=\"0\">"."Select Supplier";

                    while ($row=mysql_fetch_array($result)) 
                    { 
                        $id=$row["id"]; 
                        $supp=$row["supplier_name"];


                        $options="<OPTION VALUE=\"$id\">".$supp."</option>"; 
                        echo "<br>";
                        echo $options;

                    } 

                    }else{

                    $sql="SELECT * FROM supplier"; 
                    $result=mysql_query($sql); 

                    $options=""; 

                    echo "<OPTION VALUE=\"0\">"."Select Supplier";

                    while ($row=mysql_fetch_array($result)) 
                    { 
                        $id=$row["id"]; 
                        $supplier_named=$row["supplier_name"];
                        $name = $_POST['name'];


                        $options="<OPTION VALUE=\"$id\">".$supplier_named."</option>"; 
                        echo "<br>";
                        echo $options;

                    } 

                    //EXTRACT DATA FOR THE SELECTED ID
                    $sqls="SELECT * FROM supplier WHERE id='$id' "; 
                    $results=mysql_query($sqls); 

                    while ($rowd=mysql_fetch_array($results)) 
                    { 

                        $supplier_named=$rowd["supplier_name"];
                        $name = $rowd['name'];
                        $surname = $rowd['surname'];
                        $supplier_name = $rowd['supplier_name'];
                        $email = $rowd['email'];
                        $value = $rowd['value'];
                        $contact_number = $rowd['contact_number'];
                        $fax = $rowd['fax'];
                        $clientstatus = $rowd['clientstatus'];
                        $booking_ref = $rowd['booking_ref'];
                        $order_ref = $rowd['order_ref'];
                        $inv_ref = $rowd['inv_ref'];
                        $docdate = $rowd['docdate'];
                        $stub_ref = $rowd['stub_ref'];
                        $paid_date = $rowd['paid_date'];
                        $paid_amount = $rowd['paid_amount'];
                        $capturedate = $rowd['capturedate'];
                        $userid = $rowd['userid'];
                        $docname = $rowd['docname'];





                    }


                    }
        ?>
</select>

below I have say textbox

<input type"text" name="supplier_name" value=<?php echo "$supplier_name"; ?>>

What cuases the data to be cut off from mysql when I display it, the dropdown shows the correct data

Mike

Recommended Answers

All 2 Replies

Member Avatar for LastMitch

@branding4you

What cuases the data to be cut off from mysql when I display it, the dropdown shows the correct data

Have you put qoutes in here

From this:

<input type"text" name="supplier_name" value=<?php echo "$supplier_name"; ?>>

to this:

<input type"text" name="supplier_name" value="<?php echo $supplier_name; ?>">

Try this if the other input doesn't solve it:

<input type"text" name="supplier_name" value="<?php echo htmlspecialchars($supplier_name); ?>">

Thank you LastMitch, You are indeed 100% on the spot. I will forever remember this. Thats how we learn hey. Thank you once again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.