/    Sign up×
Community /Pin to ProfileBookmark

Sending forms to database

Here is my code, I’m using sessions in order to grab the information. The information prints out on a page but does not send to database but it is connected. CODE:

[code=php]
<?php
session_start(); // allows the sessions to be brought in by starting them
// retrieves the information from the sessions
$_SESSION[‘apache’] = $_POST[‘apache’];
$_SESSION[‘docRea’] = $_POST[‘docRea’];
$_SESSION[‘geek’] = $_POST[‘geek’];
$_SESSION[‘javascript’] = $_POST[‘javascript’];
$_SESSION[‘mysql’] = $_POST[‘mysql’];
$_SESSION[‘php’] = $_POST[‘php’];
$_SESSION[‘web’] = $_POST[‘web’];
?>
<html>
<head>
<title> Registeration Page for Conference</title>
</head>
<body>
<form action = “m5donovanConfirmation.php” method = “post”>

<center>

<font color=”#C11B17″><h1>You have input the following data, if you need to make any changes, please do so now before submitting! Thanks</h1></font>
<br />
<h3><font color=”#FF0000″>Personal Information</font></h3>
E-mail:<input type=”text” name=”email” value=”<?php print $_SESSION[’email’];?>”><br />
First Name:<input type=”text” name=”firstName” value=”<?php print $_SESSION[‘firstName’];?>”> <br />
Last Name<input type=”text” name=”email” value=”<?php print $_SESSION[‘lastName’];?>”> <br />
Address:<input type=”text” name=”email” value=”<?php print $_SESSION[‘address’];?>”> <br />
City:<input type=”text” name=”email” value=”<?php print $_SESSION[‘city’];?>”> <br />
State:<input type=”text” name=”email” value=”<?php print $_SESSION[‘state’];?>”> <br />
Zip:<input type=”text” name=”email” value=”<?php print $_SESSION[‘zip’];?>”> <br />
Phone:<input type=”text” name=”email” value=”<?php print $_SESSION[‘phone’];?>”> <br />
<h3><font color = “#254117 “>Company Information</font></h3>
CO_Address:<input type=”text” name=”email” value=”<?php print $_SESSION[‘co_address’];?>”> <br />
CO_City:<input type=”text” name=”email” value=”<?php print $_SESSION[‘co_city’];?>”> <br />
CO_State:<input type=”text” name=”email” value=”<?php print $_SESSION[‘co_state’];?>”> <br />
CO_Zip:<input type=”text” name=”email” value=”<?php print $_SESSION[‘co_zip’];?>”> <br />

<h3><font color=”#AF7817″>Seminars you will be attending</font></h3>
<?php
$seminar0 = (!isset($_POST[“seminar[0]”])? NULL: $_POST[“seminar[0]”]);
$seminar1 = (!isset($_POST[“seminar[1]”])? NULL: $_POST[“seminar[1]”]);
$seminar2 = (!isset($_POST[“seminar[2]”])? NULL: $_POST[“seminar[2]”]);
$seminar3 = (!isset($_POST[“seminar[3]”])? NULL: $_POST[“seminar[3]”]);
$seminar4 = (!isset($_POST[“seminar[4]”])? NULL: $_POST[“seminar[4]”]);
$seminar5 = (!isset($_POST[“seminar[5]”])? NULL: $_POST[“seminar[5]”]);
// verifies if fields have been check and the output is below
?>

Apache Seminar<input type=”checkbox” name=”seminar0″ <?php if($seminar0 ==”on”){print ” checked”;?>><br />
DocRea Fanclub<input type=”checkbox” name=”seminar1″ <?php if($seminar1 ==”on”){print ” checked”;?>><br />
Geek Seminar<input type=”checkbox” name=”seminar2″ <?php if($seminar2 ==”on”){print ” checked”;?><br />
Javascript Seminar<input type=”checkbox” name=”seminar3″ <?php if($seminar3 ==”on”){print ” checked”;?><br />
Mysql Seminar<input type=”checkbox” name=”seminar4″ <?php if($seminar4 ==”on”){print ” checked”;?><br />
PHP Seminar<input type=”checkbox” name=”seminar5″ <?php if($seminar5 ==”on”){print ” checked”;?>
</center>

</form>
<?php
$DBConnect = @new mysqli(“localhost”, “root”, “”); // attempting to log on
if (mysqli_connect_errno())
die (“<p>Unable to connect to the database server.)</p>”
. “<p>Error code ” . mysqli_connect_errno ()
. “: ” . mysqli_connect_errnor()) . “</p>”;
$DBName = “conference”;
@$DBConnect ->select_db($DBName) // connecting to the db from name above
or die(“<p>Unable to select the database.</p>”
. “<p>Error code ” . mysqli_errno($DBConnect)
. “: ” . mysqli_error($DBConnect)) . “</p>”; // outputs error messages if unable to connect

$TableName = “registeration”;
// gathers data to send to correct database and table
$email = $_SESSION[’email’];
$password = $_SESSION[‘password’];
$date = $_SESSION[‘date’];
$firstName = $_SESSION[‘firstName’];
$lastName = $_SESSION[‘lastName’];
$address = $_SESSION[‘address’];
$city = $_SESSION[‘city’];
$state = $_SESSION[‘state’];
$zip = $_SESSION[‘zip’];
$phone = $_SESSION[‘phone’];
$company = $_SESSION[‘company’];
$co_address = $_SESSION[‘co_address’];
$co_city = $_SESSION[‘co_city’];
$co_state = $_SESSION[‘co_state’];
$co_zip = $_SESSION[‘co_zip’];
$co_phone = $_SESSION[‘co_phone’];
$apache_seminar = $_SESSION[‘apache’];
$docrea_fanclub = $_SESSION[‘docRea’];
$geek_seminar = $_SESSION[‘geek’];
$javascript_seminar = $_SESSION[‘javascript’];
$php_seminar = $_SESSION[‘php’];
$web_services_seminar = $_SESSION[‘web’];
// sends the data that is received from the sessions to the database and has to stay in same order as database was creatd
$SQLstring = “INSTERT INTO $TableName VALUES(‘$email’, ‘$password’, ‘$date’, ‘$firstName’, ‘$lastName’, ‘$address’, ‘$city’, ‘$state’, ‘$zip’, ‘$phone’, ‘$company’, ‘$co_address’, ‘$co_city’, ‘$co_state’, ‘$co_zip’,’$co_phone’, ‘$apache_seminar’,’$docrea_fanclub’,’$geek_seminar’,’$javascript_seminar’,’$php_seminar,’$web_servic es_seminar’)”;

// lets you know if your query build was successful or not

$QueryResult = @mysqli_query($DBConnect, $SQLstring)
or die(“<p>Unable to execute the query.</p>”
. “<p>Error code ” . mysqli_errno($DBConnect)
. “: ” . mysqli_error($DBConnect)) . “</p>”;

$DBConnect->close(); // closes the database

?>
</body>
</html>
[/code]

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@chazzyDec 09.2006 — for one, i'd recommend you didn't use so many @'s to suppress your errors.

Also, is mysqli_error/errno returning anything?
Copy linkTweet thisAlerts:
@duff2481authorDec 09.2006 — Okay, I have gotten rid of all error messages except one. The most important. It is telling me it cannot connect to the database. Anyone have any thoughts as what I should check??


If I uncomment the information at the bottom that deals with the queryresult and such, I receive an unexpected EXIT error. If I comment these back out it tells me that it cannot connect to the DB..... Do not have something closed off that I should?
[code=php]
<?php
session_start();
$_SESSION['apache'] = $_POST['apache'];
$_SESSION['docRea'] = $_POST['docRea'];
$_SESSION['geek'] = $_POST['geek'];
$_SESSION['javascript'] = $_POST['javascript'];
$_SESSION['mysql'] = $_POST['mysql'];
$_SESSION['php'] = $_POST['php'];
$_SESSION['web'] = $_POST['web'];
?>
<html>
<head>
<title> Registeration Page for Conference</title>
<body>
<form action = "m5donovanConfirmation.php" method = "post">
<?php
if(isset($_POST['seminar[0]'])) {
$checked1 = "checked";
}
else {
$checked1 = '';
}
if (isset($_POST['Seminar[1]'])) {
$checked2 = "checked";
}
else {
$checked2 = '';
}

if (isset($_POST['Seminar[2]'])) {
$checked3 = "checked";
}
else {
$checked3 = '';
}

if (isset($_POST['Seminar[3]'])) {
$checked4 = "checked";
}
else {
$checked4 = '';
}

if (isset($_POST['Seminar[5]'])) {
$checked4 = "checked";
}
else {
$checked4 = '';
}
if (isset($_POST['Seminar[6]'])) {
$checked5 = "checked";
}
else {
$checked5 = '';
}


?>
<center>

<font color="#C11B17"><h1>You have input the following data, if you need to make any changes, please do so now before submitting! Thanks</h1></font>
<br />
<h3><font color="#FF0000">Personal Information</font></h3>
E-mail:<input type="text" name="email" value="<?php print $_SESSION['email'];?>"><br />
First Name:<input type="text" name="firstName" value="<?php print $_SESSION['firstName'];?>"> <br />
Last Name<input type="text" name="email" value="<?php print $_SESSION['lastName'];?>"> <br />
Address:<input type="text" name="email" value="<?php print $_SESSION['address'];?>"> <br />
City:<input type="text" name="email" value="<?php print $_SESSION['city'];?>"> <br />
State:<input type="text" name="email" value="<?php print $_SESSION['state'];?>"> <br />
Zip:<input type="text" name="email" value="<?php print $_SESSION['zip'];?>"> <br />
Phone:<input type="text" name="email" value="<?php print $_SESSION['phone'];?>"> <br />
<h3><font color = "#254117 ">Company Information</font></h3>
CO_Address:<input type="text" name="email" value="<?php print $_SESSION['co_address'];?>"> <br />
CO_City:<input type="text" name="email" value="<?php print $_SESSION['co_city'];?>"> <br />
CO_State:<input type="text" name="email" value="<?php print $_SESSION['co_state'];?>"> <br />
CO_Zip:<input type="text" name="email" value="<?php print $_SESSION['co_zip'];?>"> <br />
<h3><font color="#AF7817">Seminars you will be attending</font></h3>

Apache Seminar<input ID="s0" type="checkbox" name="seminar0" value="seminar0"<?php print $checked0;?>></br>
DocRea Fanclub<input ID="s1" type="checkbox" name="seminar1" value="seminar1"<?php print $checked1;?>></br>
Geek Seminar<input ID="s2" type="checkbox" name="seminar2" value="seminar2"<?php print $checked2;?>></br>
Javascript Seminar<input ID="s3" type="checkbox" name="seminar3" value="seminar3"<?php print $checked3;?>><label for="s3"></br>
Mysql Seminar<input ID="s4" type="checkbox" name="seminar4" value="seminar4"<?php print $checked4;?>></br>
PHP Seminar<input ID="s5" type="checkbox" name="seminar5" value="seminar5"<?php print $checked5;?>>


</form>
<?php
$DBConnect = @mysqli_connect("localhost", "root", ""); // attempting to log on
die ("<p>Unable to connect to the database server.</p>"
. "<p>Error code " . mysqli_connect_errno ()
. ": " . mysqli_connect_error()) . "</p>";
$DBName = "conference";

@mysqli_select_db($DBConnect, $DBName)

or die("<p>Unable to select the database.</p>"
. "<p>Error code " . mysqli_errno($DBConnect)
. ": " . mysqli_error($DBConnect)) . "</p>";


$TableName = "registeration";
// gathers data to send to correct database and table

$email = $_SESSION['email'];
$password = $_SESSION['password'];
$date = $_SESSION['date'];
$firstName = $_SESSION['firstName'];
$lastName = $_SESSION['lastName'];
$address = $_SESSION['address'];
$city = $_SESSION['city'];
$state = $_SESSION['state'];
$zip = $_SESSION['zip'];
$phone = $_SESSION['phone'];
$company = $_SESSION['company'];
$co_address = $_SESSION['co_address'];
$co_city = $_SESSION['co_city'];
$co_state = $_SESSION['co_state'];
$co_zip = $_SESSION['co_zip'];
$co_phone = $_SESSION['co_phone'];
$apache_seminar = $_SESSION['apache'];
$docrea_fanclub = $_SESSION['docRea'];
$geek_seminar = $_SESSION['geek'];
$javascript_seminar = $_SESSION['javascript'];
$php_seminar = $_SESSION['php'];
$web_services_seminar = $_SESSION['web'];

//$SQLstring = "INSTERT INTO $TableName VALUES('$email', '$password', '$date', '$firstName', '$lastName', '$address', '$city', '$state', '$zip', '$phone', '$company', '$co_address', '$co_city', '$co_state', '$co_zip','$co_phone', '$apache_seminar','$docrea_fanclub','$geek_seminar','$javascript_seminar','$php_seminar,'$web_services_seminar')";

//$QueryResult = @mysqli_query($DBConnect, $SQLstring)
die("<p>Unable to execute the query.</p>"
. "<p>Error code " . mysqli_errno($DBConnect)
. ": " . mysqli_error($DBConnect)) . "</p>";
//mysqli_close($DBConnect);
//$DBConnect->close(); // closes the database


?>
</body>
</html>


[/code]
Copy linkTweet thisAlerts:
@duff2481authorDec 09.2006 — Okay, my results tell me i'm in the database but it is not submitting my information, do I create a button for that and point it somewhere?? How does that work??

here is the code:
[code=php]
<?php
session_start();
$_SESSION['apache'] = $_POST['apache'];
$_SESSION['docRea'] = $_POST['docRea'];
$_SESSION['geek'] = $_POST['geek'];
$_SESSION['javascript'] = $_POST['javascript'];
$_SESSION['mysql'] = $_POST['mysql'];
$_SESSION['php'] = $_POST['php'];
$_SESSION['web'] = $_POST['web'];
?>
<html>
<head>
<title> Registeration Page for Conference</title>
<body>
<form action = "m5donovanConfirmation.php" method = "post">
<?php
if(isset($_POST['seminar[0]'])) {
$checked1 = "checked";
}
else {
$checked1 = '';
}
if (isset($_POST['Seminar[1]'])) {
$checked2 = "checked";
}
else {
$checked2 = '';
}

if (isset($_POST['Seminar[2]'])) {
$checked3 = "checked";
}
else {
$checked3 = '';
}

if (isset($_POST['Seminar[3]'])) {
$checked4 = "checked";
}
else {
$checked4 = '';
}

if (isset($_POST['Seminar[5]'])) {
$checked4 = "checked";
}
else {
$checked4 = '';
}
if (isset($_POST['Seminar[6]'])) {
$checked5 = "checked";
}
else {
$checked5 = '';
}


?>
<center>

<font color="#C11B17"><h1>You have input the following data, if you need to make any changes, please do so now before submitting! Thanks</h1></font>
<br />
<h3><font color="#FF0000">Personal Information</font></h3>
E-mail:<input type="text" name="email" value="<?php print $_SESSION['email'];?>"><br />
First Name:<input type="text" name="firstName" value="<?php print $_SESSION['firstName'];?>"> <br />
Last Name<input type="text" name="email" value="<?php print $_SESSION['lastName'];?>"> <br />
Address:<input type="text" name="email" value="<?php print $_SESSION['address'];?>"> <br />
City:<input type="text" name="email" value="<?php print $_SESSION['city'];?>"> <br />
State:<input type="text" name="email" value="<?php print $_SESSION['state'];?>"> <br />
Zip:<input type="text" name="email" value="<?php print $_SESSION['zip'];?>"> <br />
Phone:<input type="text" name="email" value="<?php print $_SESSION['phone'];?>"> <br />
<h3><font color = "#254117 ">Company Information</font></h3>
CO_Address:<input type="text" name="email" value="<?php print $_SESSION['co_address'];?>"> <br />
CO_City:<input type="text" name="email" value="<?php print $_SESSION['co_city'];?>"> <br />
CO_State:<input type="text" name="email" value="<?php print $_SESSION['co_state'];?>"> <br />
CO_Zip:<input type="text" name="email" value="<?php print $_SESSION['co_zip'];?>"> <br />
<h3><font color="#AF7817">Seminars you will be attending</font></h3>

Apache Seminar<input ID="s0" type="checkbox" name="seminar0" value="seminar0"<?php print $checked0;?>></br>
DocRea Fanclub<input ID="s1" type="checkbox" name="seminar1" value="seminar1"<?php print $checked1;?>></br>
Geek Seminar<input ID="s2" type="checkbox" name="seminar2" value="seminar2"<?php print $checked2;?>></br>
Javascript Seminar<input ID="s3" type="checkbox" name="seminar3" value="seminar3"<?php print $checked3;?>><label for="s3"></br>
Mysql Seminar<input ID="s4" type="checkbox" name="seminar4" value="seminar4"<?php print $checked4;?>></br>
PHP Seminar<input ID="s5" type="checkbox" name="seminar5" value="seminar5"<?php print $checked5;?>>


</form>
<?php

$DBConnect = new mysqli("localhost", "root", ""); // attempting to log on
$DBConnect ->select_db("conference");

if (!DBConnect)
print("<p>There are no entries!</p>"); // no data has been submitted, but you have been logged into database
else
print ("<p>Successfully connected to the Conference Registeration Database.</p>"); // verifies that you are connected

$TableName = "registration";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysqli_query($DBConnect, $SQLstring);
if (mysqli_num_rows($QueryResult) == 0)
die ("<p> There are no entries!</p>");

// gathers data to send to correct database and table

$email = $_SESSION['email'];
$password = $_SESSION['password'];
$date = $_SESSION['date'];
$firstName = $_SESSION['firstName'];
$lastName = $_SESSION['lastName'];
$address = $_SESSION['address'];
$city = $_SESSION['city'];
$state = $_SESSION['state'];
$zip = $_SESSION['zip'];
$phone = $_SESSION['phone'];
$company = $_SESSION['company'];
$co_address = $_SESSION['co_address'];
$co_city = $_SESSION['co_city'];
$co_state = $_SESSION['co_state'];
$co_zip = $_SESSION['co_zip'];
$co_phone = $_SESSION['co_phone'];
$apache_seminar = $_SESSION['apache'];
$docrea_fanclub = $_SESSION['docRea'];
$geek_seminar = $_SESSION['geek'];
$javascript_seminar = $_SESSION['javascript'];
$php_seminar = $_SESSION['php'];
$web_services_seminar = $_SESSION['web'];

$SQLstring = "INSTERT INTO $TableName VALUES('$email', '$password', '$date', '$firstName', '$lastName', '$address', '$city', '$state', '$zip', '$phone', '$company', '$co_address', '$co_city', '$co_state', '$co_zip','$co_phone', '$apache_seminar','$docrea_fanclub','$geek_seminar','$javascript_seminar','$php_seminar,'$web_services_seminar')";

$QueryResult = @mysqli_query($DBConnect, $SQLstring)
Or die("<p>Unable to execute the query.</p>"
. "<p>Error code " . mysqli_errno($DBConnect)
. ": " . mysqli_error($DBConnect)) . "</p>";
//mysqli_close($DBConnect);
$DBConnect->close(); // closes the database


?>
</body>
</html>




[/code]
Copy linkTweet thisAlerts:
@chazzyDec 09.2006 — for one, you're misspelling "INSERT" as "INSTERT"
Copy linkTweet thisAlerts:
@duff2481authorDec 09.2006 — Okay, I have fixed that, do you see any other glaring issues that need to be fixed? It still doesn't send the data to the table in the DB
Copy linkTweet thisAlerts:
@coppocksDec 09.2006 — Are there any entries already in the table "registration"? If not, then it "may be" failing because of these lines...
<i>
</i>$TableName = "registration";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysqli_query($DBConnect, $SQLstring);
if (mysqli_num_rows($QueryResult) == 0)
die ("&lt;p&gt; There are no entries!&lt;/p&gt;");


I'm just guessing... but if you are querying an empty table, for whatever reason, then it will "die". I don't see what that particular Query does.

Try commenting these out and see if it works:

<i>
</i>$TableName = "registration"; // start after this line
//$SQLstring = "SELECT * FROM $TableName"; // you're defining it again later
//$QueryResult = @mysqli_query($DBConnect, $SQLstring); // you're defining it again later
//if (mysqli_num_rows($QueryResult) == 0) // if the table is empty... it's not gonna add anything
// die ("&lt;p&gt; There are no entries!&lt;/p&gt;");


I dunno if that's gonna work... but ... give it a try.
Copy linkTweet thisAlerts:
@duff2481authorDec 09.2006 — Okay, I have change a little bit of the code here is new code:
[code=php]
<?php
session_start();
$_SESSION['apache'] = $_POST['apache'];
$_SESSION['docRea'] = $_POST['docRea'];
$_SESSION['geek'] = $_POST['geek'];
$_SESSION['javascript'] = $_POST['javascript'];
$_SESSION['mysql'] = $_POST['mysql'];
$_SESSION['php'] = $_POST['php'];
$_SESSION['web'] = $_POST['web'];
?>
<html>
<head>
<title> Registeration Page for Conference</title>
<body>
<form action = "m5donovanConfirmation.php" method = "post">
<?php
if(isset($_POST['seminar[0]'])) {
$checked1 = "checked";
}
else {
$checked1 = '';
}
if (isset($_POST['Seminar[1]'])) {
$checked2 = "checked";
}
else {
$checked2 = '';
}

if (isset($_POST['Seminar[2]'])) {
$checked3 = "checked";
}
else {
$checked3 = '';
}

if (isset($_POST['Seminar[3]'])) {
$checked4 = "checked";
}
else {
$checked4 = '';
}

if (isset($_POST['Seminar[5]'])) {
$checked4 = "checked";
}
else {
$checked4 = '';
}
if (isset($_POST['Seminar[6]'])) {
$checked5 = "checked";
}
else {
$checked5 = '';
}


?>
<center>

<font color="#C11B17"><h1>You have input the following data, if you need to make any changes, please do so now before submitting! Thanks</h1></font>
<br />
<h3><font color="#FF0000">Personal Information</font></h3>
E-mail:<input type="text" name="email" value="<?php print $_SESSION['email'];?>"><br />
First Name:<input type="text" name="firstName" value="<?php print $_SESSION['firstName'];?>"> <br />
Last Name<input type="text" name="email" value="<?php print $_SESSION['lastName'];?>"> <br />
Address:<input type="text" name="email" value="<?php print $_SESSION['address'];?>"> <br />
City:<input type="text" name="email" value="<?php print $_SESSION['city'];?>"> <br />
State:<input type="text" name="email" value="<?php print $_SESSION['state'];?>"> <br />
Zip:<input type="text" name="email" value="<?php print $_SESSION['zip'];?>"> <br />
Phone:<input type="text" name="email" value="<?php print $_SESSION['phone'];?>"> <br />
<h3><font color = "#254117 ">Company Information</font></h3>
CO_Address:<input type="text" name="email" value="<?php print $_SESSION['co_address'];?>"> <br />
CO_City:<input type="text" name="email" value="<?php print $_SESSION['co_city'];?>"> <br />
CO_State:<input type="text" name="email" value="<?php print $_SESSION['co_state'];?>"> <br />
CO_Zip:<input type="text" name="email" value="<?php print $_SESSION['co_zip'];?>"> <br />
<h3><font color="#AF7817">Seminars you will be attending</font></h3>

Apache Seminar<input ID="s0" type="checkbox" name="seminar0" value="seminar0"<?php print $checked0;?>></br>
DocRea Fanclub<input ID="s1" type="checkbox" name="seminar1" value="seminar1"<?php print $checked1;?>></br>
Geek Seminar<input ID="s2" type="checkbox" name="seminar2" value="seminar2"<?php print $checked2;?>></br>
Javascript Seminar<input ID="s3" type="checkbox" name="seminar3" value="seminar3"<?php print $checked3;?>><label for="s3"></br>
Mysql Seminar<input ID="s4" type="checkbox" name="seminar4" value="seminar4"<?php print $checked4;?>></br>
PHP Seminar<input ID="s5" type="checkbox" name="seminar5" value="seminar5"<?php print $checked5;?>></br>

<input id="login" type="submit" value="Send to Database!" />
</form>
<?php

$DBConnect = new mysqli("localhost", "root", ""); // attempting to log on
$DBConnect ->select_db("conference");

//if (!DBConnect)
// print("<p>There are no entries!</p>"); // no data has been submitted, but you have been logged into database
//else
// print ("<p>Successfully connected to the Conference Registeration Database.</p>"); // verifies that you are connected

$TableName = "registration";
//$SQLstring = "SELECT * FROM $TableName";
//$QueryResult = @mysqli_query($DBConnect, $SQLstring);
//if (mysqli_num_rows($QueryResult) == 0)
//die ("<p> There are no entries!</p>");

// gathers data to send to correct database and table

$email = $_SESSION['email'];
$password = $_SESSION['password'];
$date = $_SESSION['date'];
$firstName = $_SESSION['firstName'];
$lastName = $_SESSION['lastName'];
$address = $_SESSION['address'];
$city = $_SESSION['city'];
$state = $_SESSION['state'];
$zip = $_SESSION['zip'];
$phone = $_SESSION['phone'];
$company = $_SESSION['company'];
$co_address = $_SESSION['co_address'];
$co_city = $_SESSION['co_city'];
$co_state = $_SESSION['co_state'];
$co_zip = $_SESSION['co_zip'];
$co_phone = $_SESSION['co_phone'];
$apache_seminar = $_SESSION['apache'];
$docrea_fanclub = $_SESSION['docRea'];
$geek_seminar = $_SESSION['geek'];
$javascript_seminar = $_SESSION['javascript'];
$php_seminar = $_SESSION['php'];
$web_services_seminar = $_SESSION['web'];

$results = mysqli_query("INSERT INTO registration (email, password, date, firstName, lastName, address, city, state, zip, phone, company, co_address, co_city, co_state, co_zip, co_phone, apache_semina, docrea_fanclub, geek_seminar, javascript_seminar, php_seminar, web_services_seminar)VALUES('$email', '$password', '$date', '$firstName', '$lastName', '$address', '$city', '$state', '$zip', '$phone', '$company', '$co_address', '$co_city', '$co_state', '$co_zip', '$co_phone', '$apache_seminar', '$docrea_fanclub', '$geek_seminar', '$javascript_seminar', '$php_seminar', '$web_services_seminar')");


$QueryResult = @mysqli_query($DBConnect, $results)
Or die("<p>Unable to execute the query.</p>"
. "<p>Error code " . mysqli_errno($DBConnect)
. ": " . mysqli_error($DBConnect)) . "</p>";
//mysqli_close($DBConnect);
$DBConnect->close(); // closes the database



?>
</body>
</html>


[/code]
×

Success!

Help @duff2481 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...