i have a text area on a insert form and i get errors when adding in text information.
what charachters can be entered into a text area? and what about speaical characters? eg. ":?><}{)(*&^%44
thanx
[SOLVED] Question on Field Types - Text
Moderator: General Moderators
i was just wondering what chharters can be inserted or does it now matter?
and heres my html for text area
<tr>
<td><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description:</font></b> </td>
<td><textarea cols="40" rows="5" name="P_Desc"></textarea></td>
</tr>
Code: Select all
<?php
$db = mysql_pconnect() or die ("Could not connect to database");
# mysql_select_db('models') or die ("Could not select database!");
# this is processed when the form is submitted
# back on to this page (POST METHOD)
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
# escape data and set variables
mysql_select_db('models') or die ("Could not select database!");
$P_Stock = stripslashes($_POST["P_Stock"]);
$P_Name = stripslashes($_POST["P_Name"]);
$P_Cat = stripslashes($_POST["P_Cat"]);
$P_Scale = stripslashes($_POST["P_Scale"]);
$P_Length = stripslashes($_POST["P_Length"]);
$P_Span = stripslashes($_POST["P_Span"]);
$P_Price = stripslashes($_POST["P_Price"]);
$P_Desc = stripslashes($_POST["P_Desc"]);
if (!empty($P_Stock) && !empty($P_Name))
{
$sql = "INSERT INTO planes (P_Stock, P_Name, P_Cat, P_Scale, P_Length, P_Span, P_Price, P_Desc) VALUES ('$P_Stock','$P_Name','$P_Cat','$P_Scale','$P_Length','$P_Span','$P_Price','$P_Desc')";
$result = mysql_query($sql, $db) or die ("Execution failed.");
move_uploaded_file($_FILES['file']['tmp_name'], '/var/users/modelair/modelaircraft.co.nz/htdocs/Pics/'.$_FILES['file']['name']);
echo 'File has been stored in your uploads directory.';
print "<br><b>new aircraft added</b><br><br>";
}
else
{
echo "<br><b>Make sure stock code AND name are filled out</b><br><br>";
}
}
?><tr>
<td><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description:</font></b> </td>
<td><textarea cols="40" rows="5" name="P_Desc"></textarea></td>
</tr>
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
it generally doesn't matter.. I was just trying to see if you were accidently doing something to the value, which it looks like you aren't really.. have you tried echoing $P_Desc after you load it in from the post? .. You may need to addslashes() to it before inserting it.
However, if it's binary data, use a blob instead. As those are intended to store binary data.
However, if it's binary data, use a blob instead. As those are intended to store binary data.