Join 132,673 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,174 people online right now. Registration is fast and FREE... Join Now!
hello... i was trying to make a sumbit form, but osmthing is going wrong somewhere.. please advice
in the main page <form action="register.php" mode="post> username: <input type="text" name="usernme> password <input type="password" name="password"> <input type="submit" name="submit"> </form
in register.php
<?php $con=mysql_connect("fdb1.awardspace.com","username","password") or die("could not connect to the database"); $db=mysql_select("DB name",$con) or die("could not select"); $query="INSERT INTO 'first'('username','password') VALUES('username $_POST[username]','password $_POST[password]')"; $result=mysql_query($query); mysql_cloase($con): ?>
Like one of my friend told me... this helps to add new entries into the db but when i refresh my online db (provided by awardspace) there is no new entery.. why?? the commands to add an element is right then wats going wrong?
If you change from POST to GET, you can see the values in the URL bar.
I guess this statement is somewhat wrong, 'password $_POST[password]') as far as i assume... $_POST[...] should not work within quotes ''
i might be wrong. you better take values into some variable, and then put it in database. better check by using echo, that weather values are received on server or not.
If you change from POST to GET, you can see the values in the URL bar.
I guess this statement is somewhat wrong, 'password $_POST[password]') as far as i assume... $_POST[...] should not work within quotes ''
i might be wrong. you better take values into some variable, and then put it in database. better check by using echo, that weather values are received on server or not.
Hello mukesh i just tried making small adjustments like u said
CODE
<?php $con=mysql_connect("fdb1.awardspace.com","bakwas_1stone","1stone") or die('couldnot connect'); $db=mysql_select("bakwas_1stone",$con) or die(' could not select'); $var1=$_POST[username]; echo $var1; $var2=$_POST[password]; echo$var2; $query="INSERT INTO 'first'('username','password') VALUES($var1,$var2)"; $result=mysql_query($query); mysql_close($con); echo "registration sucessfull!('username: $_POST[username]','Password $_POST[password]')";
?>
nothing seems to be working.. not even the echo... i suppose the POST is not working properly.. it not taking any values.. and hence not able to display anything
If you change from POST to GET, you can see the values in the URL bar.
OMG even get isnt seem to be working am actually learning and i have a website for practicin thats where am trying.. when am done with learning ill make my dream web yeah so the link is http://www.bakwas.co.nr here in "signup" the 1st form... the username and passowrd isnt working
u can check out even the 2nd form isnt working but there i have tried to implement files the text will get saved in a file
$con=mysql_connect("fdb1.awardspace.com","username","password") or die("could not connect to the database"); $db=mysql_select("DB name",$con) or die("could not select");
Just to assure that I have the information I'm thinking I do, I'll generally issue something like this:
CODE
if($_POST['username']) $username = $_POST['username']; else echo "username was not set!<br>"; if($_POST['password']) $password = $_POST['password']; else echo "password was not set!<br>";
Just to assure that I have the information I'm thinking I do, I'll generally issue something like this:
CODE
if($_POST['username']) $username = $_POST['username']; else echo "username was not set!<br>"; if($_POST['password']) $password = $_POST['password']; else echo "password was not set!<br>";
$con=mysql_connect("fdb1.awardspace.com","username","password") or die("could not connect to the database"); $db=mysql_select("DB name",$con) or die("could not select");
$con=mysql_connect("fdb1.awardspace.com","username","password") or die("could not connect to the database"); $db=mysql_select("DB name",$con) or die("could not select");
$query="INSERT INTO first (username,password) VALUES('$username,'password')";
$result=mysql_query($query); mysql_cloase($con):
?>
This post has been edited by shanu_040: 9 Aug, 2007 - 09:37 PM
$query="INSERT INTO first (username,password) VALUES('$username,'password')"; i suppose that is one typing error... my code is the same the only difference is that after assigning the values to the variables i echo the output (as few ppl here adviced me) but even that is not getting echoed i doubt something else is going wrong now if u go to www.bakwas.co.nr which is where am practicin all this.. in the signup page when u click refresh the page isnt getting refreshed instead the home page is opening... so that means i havent really mived from the home page maybe that is creating disturbance to the coding???
Any suggestions as to wat is going wrong?? i suppose the coding for the page is right!!