mike12255 Posted July 20, 2009 Share Posted July 20, 2009 I got a huge form and im trying to retrive some data from it, the first two feilds, username and password to enter them into a database, however whenever i die my $_post['user'] an my $_post['pass'] they return empty can anyone see why? index.php <!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>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #666666; } @charset "utf-8"; /* CSS Document */ body { background-color:#F7F7F7; } fieldset { border:1px dashed #CCC; padding:10px; } legend { font-family:Arial, Helvetica, sans-serif; font-size: 90%; letter-spacing: -1px; font-weight: bold; line-height: 1.1; color:#fff; background: #666; border: 1px solid #333; padding: 2px 6px; } h1 { font-family:Arial, Helvetica, sans-serif; font-size: 175%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#333; } label { width:142px; height:32px; margin-top:3px; margin-right:2px; padding-top:11px; padding-left:6px; background-color:#CCCCCC; float:left; display: block; font-family:Arial, Helvetica, sans-serif; font-size: 115%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#666; } .form { margin:0; padding:0; } #container { width:750px; margin:auto; padding:10px; } #top { width:680px; height:50px; } #leftSide { width:530px; padding-top:30px; float:left; } #rightSide { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #websitebox { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #database { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #pages { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } .clear { clear:both; } .holder { background-color:#fff; } .div_texbox { width:347px; float:right; background-color:#E6E6E6; height:35px; margin-top:3px; padding-top:5px; padding-bottom:3px; padding-left:5px; } .textbox { background-image: url(images/16t.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .textbox:focus, .textbox:hover { background-color:#F0FFE6; } .username { background-image: url(images/16m.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .username:focus, .username:hover { background-color:#F0FFE6; } .password { background-image: url(images/16s.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .password:focus, .password:hover { background-color:#F0FFE6; } .button_div { width:287px; float:right; background-color:#fff; border:1px solid #ccc; text-align:right; height:35px; margin-top:3px; padding:5px 32px 3px; } .buttons { background: #e3e3db; font-size:12px; color: #989070; padding: 6px 14px; border-width: 2px; border-style: solid; border-color: #fff #d8d8d0 #d8d8d0 #fff; text-decoration: none; text-transform:uppercase; font-weight:bold; } --> </style> <script language="javascript"> <!-- // PLEASE DO NOT REMOVE THIS. THANKS // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com var state = 'hidden'; function showhide(layer_ref) { if (state == 'visible') { state = 'hidden'; } else { state = 'visible'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.visibility = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].visibility = state; } if (document.getElementById && !document.all) { maxwell_smart = document.getElementById(layer_ref); maxwell_smart.style.visibility = state; } } //--> </script> </head> <div id="container"> <div id="top"> <h1>Installation Step 1 Of 3</h1> </div> <div id="leftSide"> <fieldset> <legend>Login details</legend> <form action="index.php" method="POST" class="form"> <label for="username">Username</label> <div class="div_texbox"> <input name="username" type="text" class="username" id="username" value="username" onclick="showhide('rightSide');" /> </div> <label for="password">Password</label> <div class="div_texbox"> <input name="password" type="password" class="password" id="password" value="password" /> </div> </fieldset> <br /><hr size="1"><br /> <fieldset> <legend>Website Info</legend> <label for="website">Website Name</label> <div class="div_texbox"> <input name="website" type="text" class="textbox" id="website" value="www.website.com" onclick="showhide('websitebox');"/> </div> <label for="email">Your Email</label> <div class="div_texbox"> <input name="email" type="text" class="textbox" id="email" value="Youremail@email.com" /> </div> <label for="email"># Of Pages</label> <div class="div_texbox"> <input name="pages" type="text" class="textbox" id="Pages" value="4" onclick="showhide('pages');"/> </div> </fieldset> <br /><hr size="1"><br /> <fieldset> <legend>Database Info</legend> <label for="website">DB IP</label> <div class="div_texbox"> <input name="db" type="database" class="textbox" id="db" value="localhost/10.0.2.34.1" onclick="showhide('database');"/> </div> <label for="email">DB User</label> <div class="div_texbox"> <input name="dbuser" type="text" class="textbox" id="dbuser" value="CASteakComapny" /> </div> <label for="email">DB Password</label> <div class="div_texbox"> <input name="dbpass" type="password" class="password" id="dbpass" value="dfsdfsdfsdfsd" /> </div> <label for="email">DB Name</label> <div class="div_texbox"> <input name="dbname" type="text" class="textbox" id="dbname" value="Database_Name" /> </div> </fieldset> <br /><hr size="1"><br /> <fieldset> <legend>Client Details</legend> <label for="name">Client Name</label> <div class="div_texbox"> <input name="cname" type="text" class="textbox" id="cname" value="John Doe" /> </div> <label for="address">Client Email</label> <div class="div_texbox"> <input name="cemail" type="text" class="textbox" id="cemail" value="client@email.com" /> </div> <div class="button_div"> <input name="submit" type="submit" value="submit" class="buttons"/> </div> </form> </fieldset> </div> <div id="rightSide" style="visibility:hidden"> <p>Be sure to write down your username and password on a peice of paper, this information CANNOT be retrevied once submitted and will require a new install to fix. (If a client forgets it charge him money for you to reinstall the website he he) </p></div> <div id="websitebox" style="visibility:hidden"> <p>Do not include the http:// you just need to do www.website.com like in the exmaple provided </p></div> <div id="pages" style="visibility:hidden"> <p>This should be the number of pages that a regular user would see. NOT ADMIN PAGES they are auto created. This includes things like index pictures products contactus all the pages that anybody cant view. </p></div> <div id="database" style="visibility:hidden"> <p>Like Everything else in the installation, you cannot change this once installed so test first to make sure you got a db connection on this ip </p></div> <div class="clear"></div> </div> <body> </body> </html> step2.php <?php //error_reporting(0); error_reporting(E_ALL); ?> <!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>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #666666; } @charset "utf-8"; /* CSS Document */ body { background-color:#F7F7F7; } fieldset { border:1px dashed #CCC; padding:10px; } legend { font-family:Arial, Helvetica, sans-serif; font-size: 90%; letter-spacing: -1px; font-weight: bold; line-height: 1.1; color:#fff; background: #666; border: 1px solid #333; padding: 2px 6px; } h1 { font-family:Arial, Helvetica, sans-serif; font-size: 175%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#333; } label { width:142px; height:32px; margin-top:3px; margin-right:2px; padding-top:11px; padding-left:6px; background-color:#CCCCCC; float:left; display: block; font-family:Arial, Helvetica, sans-serif; font-size: 115%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#666; } .form { margin:0; padding:0; } #container { width:750px; margin:auto; padding:10px; } #top { width:680px; height:50px; } #leftSide { width:530px; padding-top:30px; float:left; } #rightSide { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #websitebox { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #database { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #pages { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } .clear { clear:both; } .holder { background-color:#fff; } .div_texbox { width:347px; float:right; background-color:#E6E6E6; height:35px; margin-top:3px; padding-top:5px; padding-bottom:3px; padding-left:5px; } .textbox { background-image: url(images/16t.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .textbox:focus, .textbox:hover { background-color:#F0FFE6; } .username { background-image: url(images/16m.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .username:focus, .username:hover { background-color:#F0FFE6; } .password { background-image: url(images/16s.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .password:focus, .password:hover { background-color:#F0FFE6; } .button_div { width:287px; float:right; background-color:#fff; border:1px solid #ccc; text-align:right; height:35px; margin-top:3px; padding:5px 32px 3px; } .buttons { background: #e3e3db; font-size:12px; color: #989070; padding: 6px 14px; border-width: 2px; border-style: solid; border-color: #fff #d8d8d0 #d8d8d0 #fff; text-decoration: none; text-transform:uppercase; font-weight:bold; } --> </style> <script language="javascript"> <!-- // PLEASE DO NOT REMOVE THIS. THANKS // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com var state = 'hidden'; function showhide(layer_ref) { if (state == 'visible') { state = 'hidden'; } else { state = 'visible'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.visibility = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].visibility = state; } if (document.getElementById && !document.all) { maxwell_smart = document.getElementById(layer_ref); maxwell_smart.style.visibility = state; } } //--> </script> </head> <div id="container"> <div id="top"> <?php if ($_POST['submit']){ ?> <h1>Installation Step 2 Of 3</h1> </div> <div id="leftSide"> <?php if (mysql_connect($_POST['db'],$_POST['dbuser'],$_POST['dbpass'])){ if (mysql_select_db($_POST['dbname'])){ $sql1= " CREATE TABLE `schoolw1_admin`.`users` ( `username` VARCHAR( 255 ) NOT NULL , `password` VARCHAR( 255 ) NOT NULL ) ENGINE = MYISAM"; if (mysql_query($sql1)){ echo "Created users table, moving onto inserting user info"; $user = $_POST['username']; $pass = md5($_POST['password']); die($pass); $sql2 = "INSERT INTO users (username,password) VALUES('$user','$pass')"; if (mysql_query($sql2)){ echo "Username and password sucsesfully added!"; } } }else{ echo "<div id=\"rightSide\">Error I could connect to the db but i couldnt select the requested db name</div>"; } }else{ echo "<div id=\"rightSide\">Error connecting to db on the entered IP</div>"; } ?> </div> <div class="clear"></div> </div> <?php }?> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 20, 2009 Share Posted July 20, 2009 try doing: print $pass; exit; instead of die($pass); edit: also, if step 2 is called step2.php, why does the form from index.php post to index.php? Quote Link to comment Share on other sites More sharing options...
play_ Posted July 20, 2009 Share Posted July 20, 2009 try putting the form inside <body></body> tags Quote Link to comment Share on other sites More sharing options...
play_ Posted July 20, 2009 Share Posted July 20, 2009 Just tried the form...seems to work for me. Array ( [username] => play [password] => secret [website] => a [email] => b [pages] => c [db] => d [dbuser] => e [dbpass] => f [dbname] => g [cname] => h [cemail] => i [submit] => submit ) And given your code, the form is redirecting to the page it's on (index.php) and not step2.php Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 20, 2009 Author Share Posted July 20, 2009 ...yeah i saw the body tag mistake shortly after posting this though i never realized the action was wrong it was still taking me to step2.php...gonna try something and report back,thanks Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 20, 2009 Author Share Posted July 20, 2009 what you typing to get that appear im still getting a blank screen after typing print $pass; here are the two edited files: index.php <!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>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #666666; } @charset "utf-8"; /* CSS Document */ body { background-color:#F7F7F7; } fieldset { border:1px dashed #CCC; padding:10px; } legend { font-family:Arial, Helvetica, sans-serif; font-size: 90%; letter-spacing: -1px; font-weight: bold; line-height: 1.1; color:#fff; background: #666; border: 1px solid #333; padding: 2px 6px; } h1 { font-family:Arial, Helvetica, sans-serif; font-size: 175%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#333; } label { width:142px; height:32px; margin-top:3px; margin-right:2px; padding-top:11px; padding-left:6px; background-color:#CCCCCC; float:left; display: block; font-family:Arial, Helvetica, sans-serif; font-size: 115%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#666; } .form { margin:0; padding:0; } #container { width:750px; margin:auto; padding:10px; } #top { width:680px; height:50px; } #leftSide { width:530px; padding-top:30px; float:left; } #rightSide { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #websitebox { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #database { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #pages { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } .clear { clear:both; } .holder { background-color:#fff; } .div_texbox { width:347px; float:right; background-color:#E6E6E6; height:35px; margin-top:3px; padding-top:5px; padding-bottom:3px; padding-left:5px; } .textbox { background-image: url(images/16t.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .textbox:focus, .textbox:hover { background-color:#F0FFE6; } .username { background-image: url(images/16m.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .username:focus, .username:hover { background-color:#F0FFE6; } .password { background-image: url(images/16s.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .password:focus, .password:hover { background-color:#F0FFE6; } .button_div { width:287px; float:right; background-color:#fff; border:1px solid #ccc; text-align:right; height:35px; margin-top:3px; padding:5px 32px 3px; } .buttons { background: #e3e3db; font-size:12px; color: #989070; padding: 6px 14px; border-width: 2px; border-style: solid; border-color: #fff #d8d8d0 #d8d8d0 #fff; text-decoration: none; text-transform:uppercase; font-weight:bold; } --> </style> <script language="text/javascript"> <!-- // PLEASE DO NOT REMOVE THIS. THANKS // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com var state = 'hidden'; function showhide(layer_ref) { if (state == 'visible') { state = 'hidden'; } else { state = 'visible'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.visibility = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].visibility = state; } if (document.getElementById && !document.all) { maxwell_smart = document.getElementById(layer_ref); maxwell_smart.style.visibility = state; } } //--> </script> </head> <body> <div id="container"> <div id="top"> <h1>Installation Step 1 Of 3</h1> </div> <div id="leftSide"> <fieldset> <legend>Login details</legend> <form action="step2.php" method="post" class="form"> <label for="username">Username</label> <div class="div_texbox"> <input name="username" type="text" class="username" id="username" value="username" onclick="showhide('rightSide');" /> </div> <label for="password">Password</label> <div class="div_texbox"> <input name="password" type="password" class="password" id="password" value="password" /> </div> </fieldset> <br /><hr size="1" /><br /> <fieldset> <legend>Website Info</legend> <label for="website">Website Name</label> <div class="div_texbox"> <input name="website" type="text" class="textbox" id="website" value="www.website.com" onclick="showhide('websitebox');"/> </div> <label for="email">Your Email</label> <div class="div_texbox"> <input name="email" type="text" class="textbox" id="email" value="Youremail@email.com" /> </div> <label for="email"># Of Pages</label> <div class="div_texbox"> <input name="pages" type="text" class="textbox" id="Pages" value="4" onclick="showhide('pages');"/> </div> </fieldset> <br /><hr size="1"/><br /> <fieldset> <legend>Database Info</legend> <label for="website">DB IP</label> <div class="div_texbox"> <input name="db" type="database" class="textbox" id="db" value="localhost/10.0.2.34.1" onclick="showhide('database');"/> </div> <label for="email">DB User</label> <div class="div_texbox"> <input name="dbuser" type="text" class="textbox" id="dbuser" value="CASteakComapny" /> </div> <label for="email">DB Password</label> <div class="div_texbox"> <input name="dbpass" type="password" class="password" id="dbpass" value="dfsdfsdfsdfsd" /> </div> <label for="email">DB Name</label> <div class="div_texbox"> <input name="dbname" type="text" class="textbox" id="dbname" value="Database_Name" /> </div> </fieldset> <br /><hr size="1"/><br /> <fieldset> <legend>Client Details</legend> <label for="name">Client Name</label> <div class="div_texbox"> <input name="cname" type="text" class="textbox" id="cname" value="John Doe" /> </div> <label for="address">Client Email</label> <div class="div_texbox"> <input name="cemail" type="text" class="textbox" id="cemail" value="client@email.com" /> </div> <div class="button_div"> <input name="submit" type="submit" value="submit" class="buttons"/> </div> </form> </fieldset> </div> <div id="rightSide" style="visibility:hidden"> <p>Be sure to write down your username and password on a peice of paper, this information CANNOT be retrevied once submitted and will require a new install to fix. (If a client forgets it charge him money for you to reinstall the website he he) </p></div> <div id="websitebox" style="visibility:hidden"> <p>Do not include the http:// you just need to do www.website.com like in the exmaple provided </p></div> <div id="pages" style="visibility:hidden"> <p>This should be the number of pages that a regular user would see. NOT ADMIN PAGES they are auto created. This includes things like index pictures products contactus all the pages that anybody cant view. </p></div> <div id="database" style="visibility:hidden"> <p>Like Everything else in the installation, you cannot change this once installed so test first to make sure you got a db connection on this ip </p></div> <div class="clear"></div> </div> </body> </html> step2.php <?php //error_reporting(0); error_reporting(E_ALL); ?> <!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>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #666666; } @charset "utf-8"; /* CSS Document */ body { background-color:#F7F7F7; } fieldset { border:1px dashed #CCC; padding:10px; } legend { font-family:Arial, Helvetica, sans-serif; font-size: 90%; letter-spacing: -1px; font-weight: bold; line-height: 1.1; color:#fff; background: #666; border: 1px solid #333; padding: 2px 6px; } h1 { font-family:Arial, Helvetica, sans-serif; font-size: 175%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#333; } label { width:142px; height:32px; margin-top:3px; margin-right:2px; padding-top:11px; padding-left:6px; background-color:#CCCCCC; float:left; display: block; font-family:Arial, Helvetica, sans-serif; font-size: 115%; letter-spacing: -1px; font-weight: normal; line-height: 1.1; color:#666; } .form { margin:0; padding:0; } #container { width:750px; margin:auto; padding:10px; } #top { width:680px; height:50px; } #leftSide { width:530px; padding-top:30px; float:left; } #rightSide { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #websitebox { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #database { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } #pages { background-color:#fff; width:200px; padding:5px; margin-top:40px; float:right; border:1px solid #CCC; font:normal 12px Arial; color:#CC0000 } .clear { clear:both; } .holder { background-color:#fff; } .div_texbox { width:347px; float:right; background-color:#E6E6E6; height:35px; margin-top:3px; padding-top:5px; padding-bottom:3px; padding-left:5px; } .textbox { background-image: url(images/16t.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .textbox:focus, .textbox:hover { background-color:#F0FFE6; } .username { background-image: url(images/16m.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .username:focus, .username:hover { background-color:#F0FFE6; } .password { background-image: url(images/16s.png); background-repeat: no-repeat; background-position:left; width:285px; font:normal 18px Arial; color: #999999; padding:3px 5px 3px 19px; } .password:focus, .password:hover { background-color:#F0FFE6; } .button_div { width:287px; float:right; background-color:#fff; border:1px solid #ccc; text-align:right; height:35px; margin-top:3px; padding:5px 32px 3px; } .buttons { background: #e3e3db; font-size:12px; color: #989070; padding: 6px 14px; border-width: 2px; border-style: solid; border-color: #fff #d8d8d0 #d8d8d0 #fff; text-decoration: none; text-transform:uppercase; font-weight:bold; } --> </style> <script language="javascript"> <!-- // PLEASE DO NOT REMOVE THIS. THANKS // FIND GREATE JAVASCRIPT CODES AT http://www.wallpaperama.com var state = 'hidden'; function showhide(layer_ref) { if (state == 'visible') { state = 'hidden'; } else { state = 'visible'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.visibility = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].visibility = state; } if (document.getElementById && !document.all) { maxwell_smart = document.getElementById(layer_ref); maxwell_smart.style.visibility = state; } } //--> </script> </head> <div id="container"> <div id="top"> <?php if ($_POST['submit']){ ?> <h1>Installation Step 2 Of 3</h1> </div> <div id="leftSide"> <?php if (mysql_connect($_POST['db'],$_POST['dbuser'],$_POST['dbpass'])){ if (mysql_select_db($_POST['dbname'])){ $sql1= " CREATE TABLE `schoolw1_admin`.`users` ( `username` VARCHAR( 255 ) NOT NULL , `password` VARCHAR( 255 ) NOT NULL ) ENGINE = MYISAM"; if (mysql_query($sql1)){ echo "Created users table, moving onto inserting user info"; $user = $_POST['username']; $pass = md5($_POST['password']); print $pass; exit; $sql2 = "INSERT INTO users (username,password) VALUES('$user','$pass')"; if (mysql_query($sql2)){ echo "Username and password sucsesfully added!"; } } }else{ echo "<div id=\"rightSide\">Error I could connect to the db but i couldnt select the requested db name</div>"; } }else{ echo "<div id=\"rightSide\">Error connecting to db on the entered IP</div>"; } ?> </div> <div class="clear"></div> </div> <?php }?> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
play_ Posted July 20, 2009 Share Posted July 20, 2009 change <form action="step2.php" method="post" class="form"> to <form action="#" method="post" class="form"> then before the form, do echo '<pre>';print_r($_POST);echo '</pre>'; Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 20, 2009 Share Posted July 20, 2009 with those files, it prints fine for me. are the parts before (connecting and creating the DB tables) working? do you have display_errors on? ini_set ("display_errors", "1"); Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 20, 2009 Author Share Posted July 20, 2009 yeah i did it one step at a time first i made sure i could connect to the db then i made sure i could connect to the db name then i made sure i could create the table users now im trying to insert into and i cant edit: turned ini_set ("display_errors", "1"); on still nothing Quote Link to comment Share on other sites More sharing options...
play_ Posted July 20, 2009 Share Posted July 20, 2009 Did you try echo '<pre>';print_r($_POST);echo '</pre>'; ? Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 20, 2009 Author Share Posted July 20, 2009 Undefined index: submit in /home/schoolw1/public_html/forjosh/step2.php on line 245 thats the error i get after posing that code shown above, but whats that mean, because it was running past that code Quote Link to comment Share on other sites More sharing options...
play_ Posted July 20, 2009 Share Posted July 20, 2009 weird. no idea. but it should not be this complicated. did you try processing the form on the same page? (index.php) ? <form action="#" method="post" class="form"> see if you get error Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 21, 2009 Author Share Posted July 21, 2009 ok heres a big headache i added this code to the top of index.php main the form post to the current page (index.php) and it works <?php if (isset($_POST['submit'])){ $user = $_POST['username']; $pass = $_POST['password']; echo $user." ".$pass; exit; } ?> seriously why wont this work on the other page Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 ok...step in the right direction...now, if you put the following at the very top of step2.php, what is the output? <?php print "Step 2 Post Data: "; print_r($_POST); exit; ?> Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 21, 2009 Author Share Posted July 21, 2009 .... Step 2 Post Data: Array ( [username] => username [password] => password [website] => www.website.com [email] => Youremail@email.com [pages] => 4 [db] => localhost/10.0.2.34.1 [dbuser] => CASteakComapny [dbpass] => dfsdfsdfsdfsd [dbname] => Database_Name [cname] => John Doe [cemail] => client@email.com [submit] => submit ) Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 21, 2009 Author Share Posted July 21, 2009 this is rediculas .. regardless i already started recording it on the index.php page 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.