mikebyrne Posted March 2, 2008 Share Posted March 2, 2008 My registration details aren't passing from my form to the database and I'm not sure why My pages are adminreg.php <td><form name="form1" method="post" action="signup_ac.php"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address:</td> <td><input type="text" name="address" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address1:</td> <td><input type="text" name="address1" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address2:</td> <td><input type="text" name="address2" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address3:</td> <td><input type="text" name="address3" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address4:</td> <td><input type="text" name="address4" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">County:</td> <td><input type="text" name="county" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Zip:</td> <td><input type="text" name="zip" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Telephone:</td> <td><input type="text" name="telephone" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Username:</td> <td><input type="text" name="username" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Password:</td> <td><input type="password" name="password" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> </form> signup_ac.php <?php include('adminconnect.php'); // table name $tbl_name=Adminusers; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; // Insert data into database $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()); ?> The sql for my db is: CREATE TABLE `adminusers` ( `name` varchar(255) collate latin1_general_ci default NULL, `address` varchar(255) collate latin1_general_ci default NULL, `address1` varchar(255) collate latin1_general_ci default NULL, `address2` varchar(255) collate latin1_general_ci default NULL, `address3` varchar(255) collate latin1_general_ci default NULL, `address4` varchar(255) collate latin1_general_ci default NULL, `county` varchar(255) collate latin1_general_ci default NULL, `zip` varchar(255) collate latin1_general_ci default NULL, `telephone` decimal(10,0) default NULL, `email` varchar(255) collate latin1_general_ci default NULL, `username` varchar(255) collate latin1_general_ci default NULL, `password` varchar(255) collate latin1_general_ci default NULL, `usertype` decimal(10,0) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 Do you get any errors? Try changing this line $tbl_name=Adminusers; To $tbl_name="adminusers"; Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 No i dont get any errors I've changed it to <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; // Insert data into database $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()); ?> But still no luck! Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 Try this, and post whatever you see on the screen. <?php $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo "<p>$sql<p>"; Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 i changed signup.php to <?php $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo "<p>$sql<p>"; ?> Nothing seems to happen and no output on screen Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 You didn't delete all the stuff above it, did you? signup.php should look like this: <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo "<p>$sql<p>"; ?> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 No, I have it as you do above but still not getting any output on screen and not filling the DB Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 Hmm, that doesn't make any sense, it should for sure be printing out the $sql variable. I wonder if your form is even making it to that page. Try this and see if you see anything: <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; echo "I hope you see this..."; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo "<p>$sql<p>"; ?> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 No Still no output The whole page for adminreg.php looks like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <td><form name="form1" method="post" action="signup_ac.php"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address:</td> <td><input type="text" name="address" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address1:</td> <td><input type="text" name="address1" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address2:</td> <td><input type="text" name="address2" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address3:</td> <td><input type="text" name="address3" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address4:</td> <td><input type="text" name="address4" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">County:</td> <td><input type="text" name="county" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Zip:</td> <td><input type="text" name="zip" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Telephone:</td> <td><input type="text" name="telephone" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Username:</td> <td><input type="text" name="username" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Password:</td> <td><input type="password" name="password" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> </form> <p> </p> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html> signup_ac <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; echo "I hope you see this..."; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo "<p>$sql<p>"; ?> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 2, 2008 Share Posted March 2, 2008 Blank screens are usually the result of a fatal parse error. What do you get when you do a "view source" in your browser. Also, check your web server log file for errors. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 Look at these lines right here <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form> You just need to take out the <form> Thats messing everything up. Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 Just taken that out but still no difference Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 Strange, because when I used your code on my server it was using GET instead of post, so I took out that first form tag and it worked fine. This is the exact code I used, worked find in Mozilla and IE. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form1" method="post" action="signup_ac.php"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address:</td> <td><input type="text" name="address" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address1:</td> <td><input type="text" name="address1" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address2:</td> <td><input type="text" name="address2" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address3:</td> <td><input type="text" name="address3" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address4:</td> <td><input type="text" name="address4" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">County:</td> <td><input type="text" name="county" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Zip:</td> <td><input type="text" name="zip" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Telephone:</td> <td><input type="text" name="telephone" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Username:</td> <td><input type="text" name="username" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Password:</td> <td><input type="password" name="password" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> </form> <p> </p> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 Now im getting the I hope you see this... INSERT INTO adminusers(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('Michael', '', '', '','', '','' ,'', '', '', '', '') And it seems to be working!! Thanks What do i need to get rid of to just see my page? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 It's just going to be a blank page: <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); ?> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 Two quick questions 1) How can I redirect the page back to adminreg.php 2) I want to create a new field called Userid and when the "insert record" button is pressed I want the number "2" to be place in the Userid field along with the records Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 2, 2008 Share Posted March 2, 2008 To redirect, use the header() function. header("Location: adminreg.php"); To add another field you just follow the same steps you already did. Add the HTML form On signup_ac.php just add the field to your list$userID = $_POST['userID']; //make sure you name your input "userID" if you use this Add the information to your query Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 2, 2008 Author Share Posted March 2, 2008 Thats great got that working now! THANKS FOR ALL YOUR HELP Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.