Okay so we have a textarea
%26lt;form%26gt;
%26lt;textarea%26gt;%26lt;/textarea%26gt;
%26lt;/form%26gt;
In this form users will submit a bounch of sentences like:
Tim has 10 apples
Tim has 24 bananas
Tim has 19 grapes
I want to ignore the first sentence and add the second and third sentence into a databse...Help!
How to post a sentence of an input of a textarea into a database using php?
Give the form a submit button.
Give the textarea a name (like %26lt;textarea name="userinput"%26gt;%26lt;/textarea%26gt;)
Post the form with the submit button
Pull the post variable:
$textarea = $_POST['userinput'];
It's going to be difficult to strip the first line though, as users may not always use a period to finish a sentence. In any case, check out http://www.php.net and do a function search for str() to learn about the string functions.
Reply:Trimming the first sentence is a problem as there's no consistent way to demark the end of the first sentenence try using two fields, a text box for the first sentence and the textarea for the rest. Linebreaks are notriously difficult to capture via textareas..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment