skendo Posted August 5, 2011 Share Posted August 5, 2011 Where i am doing mistake..? Is adding but it add's empty data <head> <title>Advertiser Signup</title> </head> <body bgcolor=white> Welcome to signup Page<br> <font color=red size=5> <?php $dbid = mysql_connect('localhost','xxxx','xxxxx'); mysql_select_db("xxxxxxx",$dbid); $clientid = $_POST [dbInsertID]; $clientusername = $_POSTT[clientusername]; $clientpassword = $_POST[clientpassword] = md5($clientpassword); $email = $_POST; $clientmae = $_POST[clientname]; mysql_query("INSERT INTO my_clients (clientid, clientname, clientusername, clientpassword, email) VALUES ('$clientid', '$clientname', '$clientusernmae', '$clientpassword', '$email')"); ?> </font> <p><form method="post"> Name Surname: <input type="text" name"$clientname" size="30" /><br /> E-mail: <input type="text" name"$email" size="30" /><br /> Password: <input type="text" name"$clientpassword" size="30" /><br /> Name Surname: <input type="text" name"$clientusername" size="30" /> <input type="submit" value="Signup" </form> </body> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 Please put your code into the CODE TAGS. <input type="text" name"$clientname" size="30" /><br /> E-mail: <input type="text" name"$email" size="30" /><br /> Password: <input type="text" name"$clientpassword" size="30" /><br /> Name Surname: <input type="text" name"$clientusername" size="30" /> your missing names for your input types, and for some reason you have variables beside them try this, but you don't have a input field for clientID , <head> <title>Advertiser Signup</title> </head> <body bgcolor=white> Welcome to signup Page<br> <font color=red size=5> <?php $dbid = mysql_connect('localhost','xxxx','xxxxx'); mysql_select_db("xxxxxxx",$dbid); $clientid = $_POST ['dbInsertID']; $clientusername = $_POST['clientusername']; $clientpassword = md5($_POST['clientpassword']); $email = $_POST['email']; $clientname= $_POST['clientname']; mysql_query("INSERT INTO my_clients (clientid, clientname, clientusername, clientpassword, email) VALUES ('$clientid', '$clientname', '$clientusernmae', '$clientpassword', '$email')"); ?> </font> <p><form method="post"> Name Surname: <input type="text" name="clientname" size="30" /><br /> E-mail: <input type="text" name="email" size="30" /><br /> Password: <input type="text" name="clientpassword" size="30" /><br /> Name Surname: <input type="text" name="clientusername" size="30" /> <input type="submit" value="Signup" </form> </body> Quote Link to comment Share on other sites More sharing options...
iseriouslyneedhelp Posted August 5, 2011 Share Posted August 5, 2011 $clientusername = $_POSTT[clientusername]; // has 2 "T's" Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 $clientusername = $_POSTT[clientusername]; // has 2 "T's" Thanks i fixed and for input type can you give me an example how to do that..?! I need to make it work. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 Skendo I fixed all the errors at once for you, there were more than 5 ERRORS on that code. Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 I Added that code you edited for me As i said before it adds database record but empty. Skendo I fixed all the errors at once for you, there were more than 5 ERRORS on that code. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 5, 2011 Share Posted August 5, 2011 Yes, it will do that since the query runs irrespective of whether the form has been submitted or not. Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 and also instad of 1 it adds 2 rows at same time... can some one give me a code example That i can add data to database that will ad random ID Add username Password email Name/Surname I am a beginner so really need help. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 I am going to pull my hair out today. You need to give your button a name. I suggest you read some basic HTML before tackling php. try this. <head> <title>Advertiser Signup</title> </head> <body bgcolor=white> Welcome to signup Page<br> <font color=red size=5> <?php if($_POST['submit'] != ""){ $dbid = mysql_connect('localhost','xxxx','xxxxx'); mysql_select_db("xxxxxxx",$dbid); $clientid = $_POST ['dbInsertID']; $clientusername = $_POST['clientusername']; $clientpassword = md5($_POST['clientpassword']); $email = $_POST['email']; $clientname= $_POST['clientname']; mysql_query("INSERT INTO my_clients (clientid, clientname, clientusername, clientpassword, email) VALUES ('$clientid', '$clientname', '$clientusernmae', '$clientpassword', '$email')"); } ?> </font> <p><form method="post"> Name Surname: <input type="text" name="clientname" size="30" /><br /> E-mail: <input type="text" name="email" size="30" /><br /> Password: <input type="text" name="clientpassword" size="30" /><br /> Name Surname: <input type="text" name="clientusername" size="30" /> <input type="submit" name="submit" id="submit" value="Signup" </form> </body> Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 ididnt see it :P sorry Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 and also instad of 1 it adds 2 rows at same time... can some one give me a code example That i can add data to database that will ad random ID Add username Password email Name/Surname I am a beginner so really need help. Random ID is called a primary/unique Key with an auto_increment, every tables needs to have one, not always but depending on what your doing. 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.