Chubichan Posted November 26, 2008 Share Posted November 26, 2008 I have here a PHP page that pulls from an external stylesheet. The form right now, works as a table, but not as a div formated table. Here is the code that DOES NOT work: <!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=UTF-8" /> <title>MinglePost | Completely Free Dating</title> <link rel="stylesheet" type="text/css" href="stylesheets_minglepost/style_main.css"> </head> <body> <div id="container"> <a href="index.html"><div id="logo"></div></a> <p>It really couldn't be simpler.</p> <?php if(isset($_POST['add'])) { include 'config.php'; include 'opendb.php'; $username = $_POST['username']; $email = $_POST['email']; $pass = $_POST['pass']; $query = "INSERT INTO registration (username, email, pass) VALUES ('$username', '$email', '$pass')"; mysql_query($query) or die('Error, insert query failed'); include 'closedb.php'; echo "Thank you for registering $username. Your password is $pass. There will be an email dispatched to $email with your login details for your records!"; } else { ?> <form meathod="post"> <div><label for="username">Username:</label><input name="username" type="text" id="username" size="30" /></div> <div><label for="email">Email:</label><input name="email" type="text" id="email" size="30" /></div> <div><label for="pass">Password:</label><input name="pass" type="password" id="pass" size="30" /></div> <div class="actions"><input type="submit" input name="add" value="Submit" id="add" class="submit"/></div> </form> <?php } ?> <ol id="help_bar"> <li class="first"><a href="register.html">Register</a></li> <li class="first"><a href="advertise.html">Advertise</a></li> <li class="last"><a href="#">Policy</a></li> </ol> </div> </div> </body> </html> As for the supporting php documents "config" "opendb" and "closedb," I am just using them to connect and disconnect from the database. They work fine when I am using a table based form, so I know they are working as they should. I am mainly concerned with the form here as that is really the only thing that I have changed and that is what kills it. Thanks for any help. Sorry I am such a noob, but I have searched the internet high and low, bought two books, and still can't figure out what I going on. This is my last resort. Any help would be great. Cheers! Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted November 26, 2008 Share Posted November 26, 2008 First off welcome to the site, second off please use tags, and third off. What?? Are you trying to say that the form will only work when using <tables> and not when using divs, because if so this is a problem with the form not the php. Quote Link to comment Share on other sites More sharing options...
BloodyMind Posted November 26, 2008 Share Posted November 26, 2008 Mate, here is the error: <form meathod="post"> it's supposed to be <form method="post" action="<?php echo $_SERVER['PHP_SELF]; ?>"> or make the action to the name of this file hint: please try to use any IDE(Integrated Development Environment) ex: Zend Studio is brilliant Quote Link to comment Share on other sites More sharing options...
Chubichan Posted November 26, 2008 Author Share Posted November 26, 2008 Got it working. Did some research on what bloody said and took it a bit further by removing my php entirely and placing it into a separate file then calling it with <form method="post" action="reg.php"> . Worked like a charm. Also noticed some code I had in there too that needed to be removed. Thanks mate! You are all the best!! Cheers! 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.