Data won't transfer from form to database

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Sun Feb 16, 2003 12:50 pm

try this

Code: Select all


if (isset($_POST['submit']) {

// process form

$db = mysql_connect("localhost", "root");
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('".$_POST['first']."','$_POST['last']."','".$_POST['address']."','".$_POST['position']."')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";

} else{

// display form


It sounds like you have register_globals off.. which is a very good thing but makes following tutorials hard to get to work cause until php 4.2 most servers had it turned on.. SO they wrote the tutorials with register_globals on in mind.

New php-forum User
New php-forum User
Posts: 8
Joined: Wed Nov 27, 2002 12:18 pm
Location: London

Tue Feb 18, 2003 4:07 am

Error on this line:

if (isset($_POST['submit']) {

Try adding the second ')'
if (isset($_POST['submit'])) {

Paul. :wink:

Post Reply