I have created a website based on information that was inputted on a form. This will be the first page that is seen when the website is entered. However the first time this page is brought up, there is no data, so I need to send the user to the form to imput the data before they see this blank page. Like a setup page.
I am not sure how to do this. I have read tutorials on using the if statement and then redirecting the web page.
I have tried doing this from the tutorials, and I must be doing something wrong. I tried
<?php
$last_name=$basic['last_name'][0];
if(empty($last_name))
{
header("Location: url://index.php");
exit;
}
?>
in this code I tried checking to see if the last name is blank in the table basic. Last name is required on my form, so if there is no last name then I know that the form has not been filled out.
This code does not work. I tried putting it after the connection code and it didn't work, then I tried it after mysql_select_db and it didn't work, so then I tried it where the actual table is and it didn't work.
Have any suggestions as to what I am doing wrong?