Hello, Im trying to get user info from a form into my database. Its being pasted using POST. The variables are being sent and recieved BUT nothing goes into the database table ARTIST_DETAILS However the ip and emails are being recorded to the CONTACT_FORM table. PS sorry for all the reems of code. 🙂
<?php
include "includes/db_inc.php";
//Checks to make sure all required boxes are filled in
if ($username == ""){
$a1 = "Please enter a username. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($name == ""){
$a2 = "Please enter your name. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($password == ""){
$a3 = "Please enter a password. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($email == ""){
$a4 = "Please enter your email. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($based == ""){
$a5 = "Please enter where you are based. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($phone == ""){
$a5 = "Please enter your phone number. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($county == ""){
$a6 = "Please enter the county you are from. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($country == ""){
$a7 = "Please select a country. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($about == ""){
$a8 = "Please enter something about the band. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($band_artist == ""){
$a9 = "Please enter your artist/band name. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($genre == ""){
$a10 = "Please enter a music genre. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($influ == ""){
$a11 = "Please enter your musical influences. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($members == ""){
$a12 = "Please select how many members there are in your group. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($member_1 == ""){
$a13 = "You must enter at least 1 members name. ";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
if ($keywords == ""){
$a14 = "You must enter at least 1 keyword.";
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
//check if username or band name already exist
$sql_username_check = mysql_query("SELECT username FROM artist_details WHERE username='$username'");
$sql_band_check = mysql_query("SELECT band_artist FROM artist_details WHERE band_artist='$band_artist'");
$username_check = mysql_num_rows($sql_username_check);
$band_check = mysql_num_rows($sql_band_check);
if(($username_check > 0) || ($band_check > 0)){
$a_fix = "Please fix the following errors:";
if($username_check > 0){
$username_error = "<strong>The username has already been used by another member in our database. Please choose a different username!";
}
if($band_check > 0){
$band_error = "The band name you have selected has already been used by another member in our database. Please choose a different name!";
}
include 'bad_form.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
//If the user was a good boy or girl, then they will be added
//Gives us the date the user started the account and when they last loged in TO THE SECOND!
$datestarted = date("d.m.y"); //Day.Month.Year
$last_login = date("F j, Y, g:i:s a"); //Month day, yeah, h:m.s pm h is 12 hour format
//insert the new user info into the database
$sql_add_info = "INSERT INTO artist_details (username,password,name,email,phone,datestarted,based,county,country,members,genre,about,sitelink,favlink1,favlink2,favlink3,member_1,member_2,member_3,member_4,member_5,member_6,member_7,member_8,member_9,member10,mp3_1,mp3_1_name,mp3_2,mp3_2_name,mp3_3,mp3_3_name,keywords,last_login,influ) VALUES('$username','$password','$name','$email','$phone','$datestarted','$based','$country','$country','$members','$genre','$about','$sitelink','$favlink1','$favlink2','$favlink3','$member_1','$member_2','$member_3','$member_4','$member_5','$member_6','$member_7','$member_8','$member_9','$member10','$mp3_1','$mp3_1_name','$mp3_2','$mp3_2_name','$mp3_3','$mp3_3_name','$keywords','$last_login','$influ')";
$result_info = MYSQL_QUERY($sql_add_info);
$ip = getenv("HTTP_REFERER");
$query = "INSERT INTO contact_form (email,ip) VALUES('$email','$ip')";
$result = MYSQL_QUERY($query);
$to = $email;
$text = "Welcome to THE MUSIC HYPE. Your account details are being processed. Your account will remain inactive until your cheque is cleared. Here are you account details. USERNAME:$username PASSWORD:$password URL:http://www.themusichype.com/artist.php?id=$id_given Thanks webmaster@themusichype.com";
$ian = "Chad";
$from = "webmaster@themusichype.com";
$subject = 'Welcome to THE MUSIC HYPE';
$body = $text;
$headers = "From: $from ($ian)\n";
mail($to,$subject,$body,$headers);
//checks to make sure the email was sent
if(mail($to,$subject,$body,$headers)) {
$mail_good = "<p>An e-mail has been sent to $to with confirmation and your details.</p>";
} else {
$mail_good = "<p>There was a problem sending the mail. Please try again.</p>";
}
?>
HERE IT OPENS THE HTML PART OF THE PAGE WHICH INCLUDES SOME OF THE VARIABLES.