mostafatalebi Posted December 27, 2012 Share Posted December 27, 2012 (edited) Hello I have made a user registration page. I have question(s). Is my workflow mentioned below true and working? I have made an HTML+CSS (in php format) page and then have left the action attribute of registration form empty. Then I have made a .php for processing the registration. I have made a conditional, that if(isset($_POST['submit'])) is true then INSERT INTO database and if false then include("htmlPage.php') But my problem is that When I click on submit button nothing happens and the pages moves toward topmost as if the submit button is attached to an anchor point. Edited December 27, 2012 by mostafatalebi Quote Link to comment https://forums.phpfreaks.com/topic/272425-user-authentication-and-registration/ Share on other sites More sharing options...
codefossa Posted December 28, 2012 Share Posted December 28, 2012 If you leave it empty you post to yourself (the same page). So it's pretty much just refreshing the page because you don't have it set up to deal with the form data. If you press F5, you should get a warning that you're going to resend data if you'd like some proof of it posting. Quote Link to comment https://forums.phpfreaks.com/topic/272425-user-authentication-and-registration/#findComment-1401663 Share on other sites More sharing options...
mostafatalebi Posted December 28, 2012 Author Share Posted December 28, 2012 Then What should I do? How is it common to process a registration form then? Quote Link to comment https://forums.phpfreaks.com/topic/272425-user-authentication-and-registration/#findComment-1401769 Share on other sites More sharing options...
Muddy_Funster Posted December 28, 2012 Share Posted December 28, 2012 that is very dependant on environment. How your login is handled is dictated by how it is designed to interact with your site. Quote Link to comment https://forums.phpfreaks.com/topic/272425-user-authentication-and-registration/#findComment-1401770 Share on other sites More sharing options...
mostafatalebi Posted December 28, 2012 Author Share Posted December 28, 2012 (edited) I HAVE FOUND THE PROBLEM. THANKS different from what I have already said: the erro is about mysqli prepared statement syntax this my form processor: <?php $input['firstname'] = ""; $sql = new mysqli("localhost", "root", "", "sample"); mysqli_report(MYSQLI_REPORT_ALL); if(isset($_POST['submit'])) { $input['firstname'] = htmlentities($_POST['firstname'], ENT_QUOTES); if($stmt = $sql->prepare('INSERT INTO sampleData (firstname, last) VALUES (?,?))')) { $stmt->bind_param("ss", $input['firstname'],$input['firstname']); $stmt->execute(); echo "Successfully Done."; $stmt->close(); } else { echo "failed"; } } ?> AND THIS IS MY HTML FORM <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> </head> <body> <form action="inc/form_processor.php" method="post" > <input type="text" name="firstname" /> <input type="submit" name="submit" value="Send" /> </form> </body> </html> IT DOESN"T WORK. The problem is with my sql syntax Edited December 28, 2012 by mostafatalebi Quote Link to comment https://forums.phpfreaks.com/topic/272425-user-authentication-and-registration/#findComment-1401909 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.