tjmcd
01-13-2007, 09:13 PM
Hey All,
Owing to the existence of single and double quotes in our product names, I'm having a time echoing the full contents of the field
<input name="product" value="<?php echo $_product;?>" size="100"> in the following form.
Unfortunately, this is a problem as MOST of the product names WILL contain double and or single quotes.
For a product named Girls' 16" Huffy Disney Princess Bike -- for example, I get only Girls' 16. How might I get around this?
I have seen use of CURLY BRACES to call php variables, but can't seem to find references to it just now.
Please:D
<?php
if (isset($_POST['submit'])) { // Handle the form.
require_once ('mysql_connect.php');
mysql_select_db ('bike_shop');
$result = mysql_query('SELECT * FROM catalog');
// Fetch record rows in $result by while loop and put them into $row.
while($row = mysql_fetch_array($result)) {
$_product = "$row[Product]";
$_edit_descr = "$row[Description]";
}
echo $_product;
}
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="update.php">
<table border="1" cellpadding="3" cellspacing="0" width="691">
<tr>
<td align="center" bgcolor="#FFCC00" width="269"><strong>ID</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Description</strong></td>
</tr>
<tr>
<td bgcolor="#FFFFCC" width="269">
<input name="product" value="<?php echo $_product;?>" size="100"></td>
<td bgcolor="#FFFFCC"><textarea rows="5" cols="43"><?php echo $_edit_descr; ?></textarea>
</td>
</tr>
</table>
<input type="submit" name="Submit" value="Update" />
</form>
</body>
</html>
Owing to the existence of single and double quotes in our product names, I'm having a time echoing the full contents of the field
<input name="product" value="<?php echo $_product;?>" size="100"> in the following form.
Unfortunately, this is a problem as MOST of the product names WILL contain double and or single quotes.
For a product named Girls' 16" Huffy Disney Princess Bike -- for example, I get only Girls' 16. How might I get around this?
I have seen use of CURLY BRACES to call php variables, but can't seem to find references to it just now.
Please:D
<?php
if (isset($_POST['submit'])) { // Handle the form.
require_once ('mysql_connect.php');
mysql_select_db ('bike_shop');
$result = mysql_query('SELECT * FROM catalog');
// Fetch record rows in $result by while loop and put them into $row.
while($row = mysql_fetch_array($result)) {
$_product = "$row[Product]";
$_edit_descr = "$row[Description]";
}
echo $_product;
}
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="update.php">
<table border="1" cellpadding="3" cellspacing="0" width="691">
<tr>
<td align="center" bgcolor="#FFCC00" width="269"><strong>ID</strong></td>
<td align="center" bgcolor="#FFCC00"><strong>Description</strong></td>
</tr>
<tr>
<td bgcolor="#FFFFCC" width="269">
<input name="product" value="<?php echo $_product;?>" size="100"></td>
<td bgcolor="#FFFFCC"><textarea rows="5" cols="43"><?php echo $_edit_descr; ?></textarea>
</td>
</tr>
</table>
<input type="submit" name="Submit" value="Update" />
</form>
</body>
</html>