Page 1 of 1

Question on Field Types - Text

Posted: Mon Jul 12, 2004 7:35 pm
by C_Calav
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

Posted: Mon Jul 12, 2004 7:45 pm
by feyd
show us your code.

Posted: Mon Jul 12, 2004 7:50 pm
by C_Calav
i was just wondering what chharters can be inserted or does it now matter?

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>"; 
              } 


       }

?>
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>

Posted: Mon Jul 12, 2004 8:03 pm
by feyd
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.

Posted: Mon Jul 12, 2004 8:12 pm
by C_Calav
thanx feyd, ill try a blob and see, just dont like errors! ha. thanx consider this thread solved