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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.