sycik Posted December 26, 2008 Share Posted December 26, 2008 Hey, I'm still a beginner with both PHP and mySQL, I was wondering if someone could help me solve this problem. Basically what I want, is a form on my page. The particular form, can be filled out by any website visitor, when it is filled out, I want the results to immediately appear on the same page after the submit button is pressed. How can I accomplish this with both php and mysql? Quote Link to comment Share on other sites More sharing options...
trochia Posted December 26, 2008 Share Posted December 26, 2008 $formCreation = Search Forums create form with php $result = Search forums > create form with php and mysql //first step As if you're beginning in php, you sould learn this first...to write out one line to a file first. Please don't take this wrong, but you said "beggining, and that is how to begin. Quote Link to comment Share on other sites More sharing options...
gevans Posted December 26, 2008 Share Posted December 26, 2008 Start of by making the page pull data from the databsase. I'm assuming your htlm is ok so the form won't be a problem right? Quote Link to comment Share on other sites More sharing options...
trochia Posted December 26, 2008 Share Posted December 26, 2008 gevans?? Did you read what he wrote? Basically what I want, is a form on my page. And that he is a beginner? How can he pull data from a database, that more than likely doesn't exist, and what he said...he doesn't even know how to make a form yet? :-) And then he says: I want the results to immediately appear on the same page after the submit button is pressed. In order to do this "immediatley", without refreshing...He'd also need to know JS and AJAX, let alone learning how to call another page yet.. Jim Quote Link to comment Share on other sites More sharing options...
revraz Posted December 26, 2008 Share Posted December 26, 2008 Well your idea doesn't require MySQL to do, you just need to post the $_POST variables back to your form. Quote Link to comment Share on other sites More sharing options...
9three Posted December 26, 2008 Share Posted December 26, 2008 Well what you would do is this: <?php if(isset($_POST['submit'])) // The button HTML name if it is pressed eg. they clicked on it { $fields = array(); $fields[0] = $_POST['name']; $fields[1] = $_POST['lastname']; return $fields; } else // They didnt submit anything { echo 'You must fill out the application before we can display your information'; } ?> if you want to save the information on a database all you need to do is query the information to the correct table with the proper credentials. Between the brackets [''] the name of the html field would go there. So if you name the field "FirstName" then in your php you would do ['FirstName']. Note: PHP is case-sensitive so FirstName and firstname is different. Likewise, FiRsTnAmE is also different. Quote Link to comment Share on other sites More sharing options...
gevans Posted December 26, 2008 Share Posted December 26, 2008 @trochia, he said nothing about the ability to make a form or html skills. more details would of helped originally. but with a starting point he can ask a more in depth question Quote Link to comment Share on other sites More sharing options...
9three Posted December 26, 2008 Share Posted December 26, 2008 Well PHP is a server-side programming language. Although you dont need a new page to display the information you require, it will require to have a reloading time. 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.