Jump to content

i have an undefined index error, please aid me


chosensiren

Recommended Posts

<?php

//connect to the database

 require_once('connectvars.php');

 

$firstname = ( $_POST['firstname']);

$lastname = ( $_POST['lastname']);

$username = ( $_POST['username']);

$password = ( $_POST['password1']);

$email = ( $_POST['email']);

 

//insert data into table

 $query = "INSERT INTO summerfun_users (username, password, email, first_name, last_name) VALUES ($username, '$password', '$email', '$firstname', '$lastname')";

            mysqli_query($dbc, $query);

 

//confirm success with the user

echo "congrats friend, you are now a member of summer fun";

?>

 

i am getting undefined index errors on all my variables, please help

So - show us the code that comprises the web page itself. 

 

I'm guessing you have no <input> tags with "name='firstname' " or "name='lastname' ", etc. That or the fields are not within the <form>... </form> tags.  Or you are using a "method='GET' " in your form.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.