insert - hours of time - help
| From: | Marc Bragg | Date: | Sun, 11 Feb 2001 01:34:50 +0000 |
| Subject: | insert - hours of time - help | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6531@lists.php.net to get a copy of this message | ||
Help,
I have a data input form which collects information from users, and then
transmits to a page for user to view. How do I pass the input date into
the table. Have tried the following:
input.php3
<form name='frmAttyApp' method=post action="app.php3">
Please enter your last name (<i>required</i>):
<input name="last_name" type="text">
<br>
</form>
This then displays to user through app.php3:
<?php
echo (
"<b>Thank You for submitting the following:</b><br>Please double check
your answers.<br>Please click back and fix any errors prior to
submitting." . NL . NL . // new line constant.
"Last Name: $last_name" . NL
)
<form method=post action="attydb.phtml">
<?php
"$last_name,
</form>
This then hits the attdb.phtml and phtml does connect to the database as
follows:
--attydb.phtml--
<?php
mysql_connect(localhost, test);
@mysql_select_db(trial) or die("Unable to select database");
$query="INSERT INTO table values('$last_name)";
$result=mysql_query($query);
mysql_close();
?>
From my logs, I am connecting fine to the database. But the information
in the last_name is not being passed to the database. The app.php3
displays only as follows when brought into the browser:
Last Name: Bragg<br>
How do I retain the $last_name information so it passes to the database
and at the same time displays in the browser so user can be sure entry
is correct? Or, how do i pass the input to the database in the first
place?
Thanx