i searched this forum for "MySQL text", but none of the results gave me the answer which i seek, and the php.net whole-site search returned 1 result, and it was regarding bin2hex, certainly not what i'm looking for.
i'm trying to develop a very simple little app to collect a user's e-mail, first name, last name, userdata, and comments-- the last two being arbitrary fields strictly for demonstration purposes. i've done some simple things like this before w/ success, so i'm a bit puzzled as to why it doesn't work this time-- unless it has something to do w/ the fact that i'm trying to echo a MySQL TEXT field using mysql_fetch_array
here's my html post data form:
<h2>Please use the form below to enter your data:</h2>
<form method="post" action="process.php">
your e-mail:<br />
<input name="email" type="text"><br />
your first name:<br />
<input type="text" name="fname"><br />
your last name:<br />
<input type="text" name="lname"><br />
enter your choice: (favorite day to come to Rive, as a text example)<br />
<input type="text" name="udata"><br />
enter any comments here:<br />
<textarea name="comments" cols="30" rows="5">Comments here</textarea><br />
When you are finished entering your data, click the button below:<br />
<input type="submit" name="enter row" value="submit">
</form>
note the <textarea name="comments"...> above. this goes into a MySQL TEXT field. if i go to the command line and type:
myql> select * from test_table;
i can see the data in the TEXT field, so i know it went in okay.
and process.php, the action of the html form above:
<?php
$email = $_POST['email'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$udata = $_POST['udata'];
$comm = $_POST['comments'];
$connect = mysql_connect('localhost', 'myUser', 'myPass');
mysql_select_db("db1", $connect);
$sql = "INSERT INTO test_table (email, first_name, last_name, userdata, comment) values ('$email', '$fname', '$lname', '$udata', '$comm')";
mysql_query($sql, $connect);
echo "<p>the data inserted was:</p>";
echo "<p>email: $email</p>";
echo "<p>first name: $fname</p>";
echo "<p>last name: $lname</p>";
echo "<p>selection: $udata</p>";
echo "<p>comments: $comm</p>";
?>
<html>
<body><p>
Click <a href="results.php">here</a> to view the complete table data</p>
</body>
</html>
and the results.php which shows the current table data:
<?php
$conn = mysql_connect('localhost', 'myUser', 'myPass');
mysql_select_db("db1", $conn);
$sql = "SELECT * from test_table";
mysql_query($sql, $conn);
$result = mysql_query($sql, $conn);
while ($resultsArray = mysql_fetch_array($result)) {
$id = $resultsArray['id'];
$email = $resultsArray['email'];
$fname = $resultsArray['first_name'];
$lname = $resultsArray['last_name'];
$data = $resultsArray['userdata'];
$comm = $resultsArray['comments'];
echo "<p>row $id email is <strong>$email<br />";
echo "row $id full name is <strong>$fname $lname<br />";
echo "row $id selection is <strong>$data and their comments are:<p>";
echo "$comm";
}
?>
<html>
<body>
<p>click <a href="form.htm">here</a> to go back and add another entry</p>
</body>
</html>
why does my results.php not echo the $comm variable which holds the MySQL TEXT field?
thank you!