ERROR IN PHPMYADMIN AND PHP?!?!?!

i’m having a problem with my code its not working and submitting i’m using dreamweaver CS4 the code is below

[php]

Contact Us! - Omega Creations
  • Home
  • About
  • Gallery
  • Pricing
  • Contact


  • Full Name: *


    Email: *


    Youtube Channel: (If Any)


    What Do You Want?: * Youtube Channel Art Youtube Icon Logo Banner



    <?php $Submit = $_POST['Submit']; $Name = $_POST['Name']; $Want = $_POST['Type']; $Email = $_POST['Email']; $Youtube = $_POST['Youtube'];

    if(isset($Submit)){
    if($Name == ‘’){
    header(‘location: Index.php’);
    } else {
    if($Want == ‘’){
    header(‘location: Index.php’);
    } else {
    if($Email == ‘’){

    } else {
    mysql_connect(‘localhost’, ‘Admin’, ‘Password’);
    mysql_select_db(‘website’);
    mysql_query(“INSERT INTO answer (ID, Name, Email, Channel, Want) VALUES (’’, ‘$Name’,’$Email’,’$Youtube’,’$Want’)”);
    mysql_close();
    }
    }
    }
    }
    ?>

    [/php]

First thing, you are using obsolete Mysql code. Use PDO or Mysqli with prepared statements.

Second thing, remove the ID from your query and specify column names for your inserts.

Third thing. You have absolutely no data checks. Anyone can insert anything they want into your database.

Fourth thing. SQL Injection

Fifth thing. You have misssing and misplaced divs

Sixth Thing. You are missing the form action

Seventh thing. I formatted your existing code so it is more readable. (NO Changes)

[php]

Contact Us! - Omega Creations
  • Home
  • About
  • Gallery
  • Pricing
  • Contact


  • Full Name: *


    Email: *


    Youtube Channel: (If Any)


    What Do You Want?: * Youtube Channel Art Youtube Icon Logo Banner



    <?php $Submit = $_POST['Submit']; $Name = $_POST['Name']; $Want = $_POST['Type']; $Email = $_POST['Email']; $Youtube = $_POST['Youtube'];

    if (isset($Submit))
    {
    if ($Name == ‘’)
    {
    header(‘location: Index.php’);
    }
    else
    {
    if ($Want == ‘’)
    {
    header(‘location: Index.php’);
    }
    else
    {
    if ($Email == ‘’)
    {

            }
        else
            {
            mysql_connect('localhost', 'Admin', 'Password');
            mysql_select_db('website');
            mysql_query("INSERT INTO `answer` (`ID`, `Name`, `Email`, `Channel`, `Want`) VALUES ('', '$Name','$Email','$Youtube','$Want')");
            mysql_close();
            }
        }
    }
}

?>

[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service