RE: Select Value with 's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok.. 

 
First I build my select list:
 
    <SELECT NAME="Cid" size="1">
    <OPTION Selected VALUE="">All Customers</OPTION>

<?
 While ($Site = mysql_fetch_array($S)) 
 {
  $Sid = $Site["CID"];
  $SName = htmlspecialchars($Site["Customer"]);
  echo("<option value='$SName'>$SName</options>\n");
 }
?>
</select>

The optional value displays the ['] correctly when I look at the source.

When the submit button is clicked, it passes this form value Cid to the
Result.php page.

First I convert the posted value

$FF = $_POST ['Cid'];

then I use it in a select statement

$Info = mysql_query(select * FROM customer WHERE customer.customer LIKE
'$FF' );

When the customer name is all text, it works fine, but when the customer has
the [']
In it like St Mary's, the value I get on the Result.php page is St Mary

 

-----Original Message-----
From: ma [mailto:grillen@xxxxxxxxxxxxxx] 
Sent: Wednesday, November 05, 2003 1:18 PM
To: PHP-DB
Subject: Re:  Select Value with 's

hi!

do not quite understand your problem.. pls post some code?
heres a small snippet that should work well...

$qry = 'SELECT `customer` FROM `customerList` ORDER BY `customer`'; $res =
mysql_query($qry); while($customer = mysql_fetch_object($res)) {
    echo stripslashes($res->customer).'<br>'."\n";
}

hth?

_ma

# life would be easier if i knew the source code...

> Von: "Aleks @ USA.net" <Aleks.k@xxxxxxx>
> Datum: Wed, 5 Nov 2003 13:12:45 -0500
> An: <php-db@xxxxxxxxxxxxx>
> Betreff:  Select Value with 's
> 
> This is a basic question but I am all messed up and need to be 
> straightened out..
> 
> Have a select field called customer that works great except when there 
> is a '  in the customer name.
> Have tried addslash and stripslashes but I think I might be using them 
> wrong.
> 
> If I addslash to the select value, the value received but the result 
> page is truncated up to the point of
> the '   .....
> 
> Can someone refresh me on the correct use of add and strip slashes...
> please??
> 
> Thanks
> 
> Aleks
> 

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux