Hi,
My problem is very simple. I can't show out my full results whenever the data have this "&" sign. For example: If the data is "ABC & DEF". Then the output just show the "ABC", and "DEF" will gone. I'm wondering is my script mistake or not? So, hopefully anyone can give help? Thank You !
The full script shown as below:
<?php
$uname=$_GET['username'];
if(!isset($uname)){
echo "Invalid login.Please login again.<br><br>";
echo "<a href=\"cms/index.php\">Re-Login</a>";
exit();
}
?>
<?php
$cus_name=$_GET['field'];
require_once("db_connect.php");
$sql="SELECT CUS_Name FROM CUSTOMER WHERE $cus_name like '%field%' ";
$result = mysql_query($sql);
/*
$cus_name = $num['CUS_Name'];
$num = mysql_num_rows($result);
$i=0;
while ($i < $num) {
$cus_name=mysql_result($result,$i,"CUS_Name");
++$i;
*/
?>
<html>
<head>
<title>Delete Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<table width="746" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="160">
<img src="/cms/graphics/e-map-mys.gif" width="160" height="60">
</td>
<td width="586" valign="top">
<img src="/cms/graphics/banner.gif" width="586" height="60">
</td>
</tr>
<tr valign="top">
<td colspan="2" height="3" align="right">
<form name="customer" method="post" action="hcsearch.php" >
<font face="Arial, Helvetica, sans-serif">
<b>Search</b></font>:
<font face="Arial, Helvetica, sans-serif">
<input type="text" name="searchtext">
<b><font face="Arial, Helvetica, sans-serif">
By</font></b>:
<select name="searchtype">
<option value="CUS_Name">Customer Name</option>
<option value="CUS_RegNum">Reg No.</option>
<option value="CUS_Brand">Brand</option>
<option value="CUS_State">State</option>
<option value="CUS_Category">Category</option>
</select>
<input type="hidden" name="username" value="">
<input type="submit" name="Submit" value="GO!">
<br>
</form>
</td>
</tr>
<tr align="right">
<td colspan="2" height="2" bgcolor="#f98c59">
<font face="Arial, Helvetica, sans-serif"><b><font size="2">
<a href="/cms/logout.php">Logout</a></font> </b></font></td>
</tr>
<tr>
<td valign="top" rowspan="2">
<p><a href="had_index.php?username=<?php printf("$uname"); ?>">
<img src="/cms/graphics/home.gif" width="110" height="25" border="0"></a>
<a href="had_cadd.php?username=<?php printf("$uname"); ?>">
<img src="/cms/graphics/add.gif" width="110" height="25" border="0"></a>
<a href="had_cviewedit.php?username=<?php printf("$uname"); ?>">
<img src="/cms/graphics/edit.gif" width="110" height="25" border="0"></a>
</p>
</td>
<td valign="top">
<b>ARE YOU SURE YOU WANT TO DELETE:</b><br><br>
<?php $show = sprintf ($cus_name);
printf($show); ?><br><br>
<tr><td>
<form action="had_cdelete1.php?username=<?php print("$uname"); ?>" method="post">
<input name= "cus_name" type="hidden" value="<?php print($show); ?>">
<a href="had_cdelete1.php">
<input type="submit" name="option" value=" YES "></a></form>
<form action="had_cinfo.php?username=<?php print("$uname"); ?>" method="post">
<a href="had_cinfo.php">
<input type="submit" name="option1" value=" NO "><br>
</form></td></tr></a>
<p> </p>
</td>
</tr>
<tr> </tr>
<tr bgcolor="f98c59">
<td colspan="2" height="20"></td>
</tr>
<tr>
<td colspan="2" height="16" align="center">
<i><font face="Arial, Helvetica, sans-serif" size="1"> © Copyright</font></i>
<font face="Arial, Helvetica, sans-serif" size="1">
of <b>XXX</b> <i>All Rights Reserved.<br>
</font></td>
</tr>
</table>
</body>
</html>
The problem occurs on:
<?php $show = sprintf ($cus_name);
printf($b); ?>
-- and --
<input name= "cus_name" type="hidden" value="<?php print($show); ?>">