I only want this INSERT INTO php sql script to run when the input button is
pressed. How do I stop the script running when the page is loaded?
+++ Begin HTML Page +++
<?php
//create database connection
include("d:\bin\Apache\include\dbcon.inc");
?>
<html>
<head>
<title>Test Script</title>
</head>
<body>
<form name="update_names" method="post" action="<?php $PHP_SELF ?>">
<p>First Name<br>
<input type="text" name="first_name" maxlength="25" size="25"></p>
<p>Last Name<br>
<input type="text" name="last_name" maxlength="25" size="25"></p>
<p><input type="submit" name="Submit" value="Save"></p>
</form>
<?php
$sql = "INSERT INTO address (first_name, last_name) VALUES
('$first_name', '$last_name')";
$result = mysql_query($sql,$dbcon);
print ("Your new record has been entered.");
?>
</body>
</html>
+++ End HTML Page +++
Regards, Steve
==
Stephen Reynolds
[EMAIL PROTECTED]
http://www.sreynolds.net
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php