Okay after spending long, painful hours trying to put together this registration page, here is my dilema. I have a registration page at www.hoopstart.com/registration.php. This is a form where people will fill it out. I will have the data sent to a php form called customers.php. Everything works except that the fact that I continue to get the error message that the data cannot be inserted.

Can some help me? Here is the code for customers.php

<?php
$RegNo = "";
$FirstName1 = "";
$LastName1 = "";
$Age1 = "";
$Sex1 = "";
$DOB = date("m.d.y");

$ShirtSize1 = "";
$FirstName2 = "";
$LastName2 = "";
$Age2 = "";
$DOB2 = date("m.d.y");
$Sex2 = "Y";
$ShirtSize2 = "";
$FirstName = "";
$LastName = "";
$Address = "";
$City = "";
$State = "";
$Zip = "";
$DayPhone = "";
$EvePhone = "";
$CellPhone = "";
$Other = "";
$Email = "";
$NameCard = "";
$CardNo = "";
$ExpDate = date("m.y");
$CardType = "Y";
$School = "";
$Cost = "0";
$Test = "";

$connection=mysql_connect
("localhost","hoopstar_test","test") or die("Could not connect to the database server");

$db= mysql_select_db("hoopstar_HoopStartRegistration",$connection) or die ("Unable to select database.");

$sql= "INSERT INTO 'hoopstar_HoopStartRegsitration.001'(RegNo,FirstName1,LastName1,Age1,Sex1,DOB,ShirtSize1,FirstName2,LastName2,Age2,
DOB2,Sex2,ShirtSize2,FirstName,LastName,Address,City,State,Zip,DayPhone,EvePhone,CellPhone,Other,Email,
NameCard,CardNo,ExpDate,CardType,School,Cost) VALUES($RegNo,'$FirstName1','$LastName1','$Age1','$Sex1','$DOB',
'$ShirtSize1','$FirstName2','$LastName2','$Age2','$DOB2','$Sex2','$ShirtSize2','$FirstName','$LastName','$Address',
'$City','$State','$Zip','$DayPhone','$EvePhone','$CellPhone','$Other','$Email','$NameCard', '$CardNo','$ExpDate',
'$CardType','$School',$Cost)";

$sql_result = mysql_query($sql,$connection) or die ('Could not insert data');

echo('Data inserted successfully.');

mysql_close($connection)
?>

    you need something that gives your varibles a value such as

    $name = $uname = $_POST['uname'];;

    and the $uname = $_POST['uname']; should be what you called your input box in the form

    this doesent assing any value to your database

    $RegNo = "";
    $FirstName1 = "";
    $LastName1 = "";
    $Age1 = "";
    $Sex1 = "";
    $DOB = date("m.d.y");
    $ShirtSize1 = "";
    $FirstName2 = "";
    $LastName2 = "";
    $Age2 = "";
    $DOB2 = date("m.d.y");
    $Sex2 = "Y";
    $ShirtSize2 = "";
    $FirstName = "";
    $LastName = "";
    $Address = "";
    $City = "";
    $State = "";
    $Zip = "";
    $DayPhone = "";
    $EvePhone = "";
    $CellPhone = "";
    $Other = "";
    $Email = "";
    $NameCard = "";
    $CardNo = "";
    $ExpDate = date("m.y");
    $CardType = "Y";
    $School = "";
    $Cost = "0";
    $Test = "";
    

    and your $RegNo needs to be an int(11) auto incrament table

    hope this helps

      The data is still not inserting into the data.

        'hoopstar_HoopStartRegsitration.001'
        

        table names should not be enclosed in '

        instead of

        die ('Could not insert data'); 
        

        use

        die ('Could not insert data due to ' . mysql_error()); 
        

        which will give a better error message.

          It appears that my registration page is working fine because I not receiving any error messages, and it echos "Thank you for registering....but my data is not inserting into the MYSQL database. Any idea what is going on?

          username and password taken out to protect.

          <?php
          //Connect
          $link = mysql_connect('localhost', 'hoopstar_zbcd', 'abcdt') or die(mysql_error());

          $db_selected = mysql_select_db('hoopstar_HoopStartRegistration', $link);
          if (!$db_selected) {
          die ('Can\'t use hoopstar_HoopStartRegistration: ' . mysql_error());
          }

          $query= "INSERT INTO hoopstar_HoopStartRegsitration.001(RegNo,FirstName1,LastName1,Age1,Sex1,DOB,ShirtSize1,FirstName2,LastName2,Age2,
          DOB2,Sex2,ShirtSize2,FirstName,LastName,Address,City,State,Zip,DayPhone,EvePhone,CellPhone,Other,Email,
          NameCard,CardNo,ExpDate,CardType,School,Cost) VALUES('$RegNo','$FirstName1','$LastName1','$Age1','$Sex1','$DOB',
          '$ShirtSize1','$FirstName2','$LastName2','$Age2','$DOB2','$Sex2','$ShirtSize2','$FirstName','$LastName','$Address',
          '$City','$State','$Zip','$DayPhone','$EvePhone','$CellPhone','$Other','$Email','$NameCard', '$CardNo','$ExpDate',
          '$CardType','$School',$Cost)" ;

          $result = mysql_query('SELECT FirstName1 FROM hoopstar_HoopStartRegistration.001');
          if (!$result) {
          $message = 'Invalid query: ' . mysql_error() . "\n";
          $message .= 'Whole query: ' . $query;
          die($message);
          }

          echo('Thank you for registering with HoopStart.com.');
          ?>

            You had this line in earlier versions of your script

            $result = mysql_query($sql,$connection) or die ('Could not insert data'); 
            

            but is now gone

            insert this

            mysql_query($sql,$connection) or die ('Could not insert data due to ' . mysql_error()); 
            

            There is no need for a result variable when doing an insert.

              This error message is now appearing: Warning:mysql_query($sql,$connection) or die ('Could not insert data due to ' . mysql_error());

              Should I remove the below query and add your suggested insert?

              $result = mysql_query('SELECT FirstName1 FROM hoopstar_HoopStartRegistration.001');
              if (!$result) {
              $message = 'Invalid query: ' . mysql_error() . "\n";
              $message .= 'Whole query: ' . $query;
              die($message);
              }

              echo('Thank you for registering with HoopStart.com.');
              ?>

                Write a Reply...