Re: RE: [PHP] Newbie Question
| From: | Jay Fitzgerald | Date: | Thu, 08 Nov 2001 17:08:38 +0000 |
| Subject: | Re: RE: [PHP] Newbie Question | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-db+get-14153@lists.php.net to get a copy of this message | ||
Ok.....I have it working half-way now.....here is what I have so far:
===================
PHP FORM ("add_jobs.php" - submits to the script below):
<FORM METHOD="post" ACTION="do_addjobs.php">
<TEXTAREA NAME="duties" COLS="30" ROWS="10" WRAP="virtual"></TEXTAREA>
<INPUT TYPE="submit" VALUE="Add Job">
</FORM>
===================
===================
PHP SCRIPT ("do_addjobs.php" - inserts into db)
<?
if ((!$duties))
{
header("Location: add_jobs.php");
exit;
}
$sql = "INSERT INTO jobs (duties) values ('$duties')";
$connection = mysql_connect("localhost", "????", "????") or die ("Couldn't connect to the server.");
$db = mysql_select_db("????", $connection) or die ("Couldn't select the database.");
$sql_result = mysql_query($sql) or die ("Couldn't execute query.");
echo "<B>Duties:";
echo nl2br ($duties);
echo "</B>";
?>
===================
With the way I have this above, when it does "echo nl2br ($duties);" it displays fine now -- thanks for that help so far -- but the problem now (this may be normal, but I am not sure) is when I connect to the db and "select * from jobs;" the db is writing the entries like this:
===================
mysql> select * from jobs;
+----+----------+----------+--------+---------+---------------------------------+----------+----------+--------+----------+
| id | position | opendate | salary | appdate |
duties | examples | training | skills | benefits |+----+----------+----------+--------+---------+---------------------------------+----------+----------+--------+----------+
| 1 | test | test | test | test | 12 3 4 5 6 7 8
9 | test | test | test | test |+----+----------+----------+--------+---------+---------------------------------+----------+----------+--------+----------+ =================== is this in fact normal? Jay