[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I stop this script running when the page is loaded?


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
sreyno1ds@xxxxxxxxx
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 <mysql-thread77873@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.