PhdJB Posted June 12, 2007 Share Posted June 12, 2007 When I am setting up my html forms for submission to my database, I cant figure out how to get the stuff from my forms to be connected to my PHP code for submission. I've tried a couple of different methods and none have worked. Link to comment https://forums.phpfreaks.com/topic/55266-_post/ Share on other sites More sharing options...
r-it Posted June 12, 2007 Share Posted June 12, 2007 set you form's form method to post/get and action to the php page you will use to handle the posted data, and use $_POST or $_GET to retrieve the data Link to comment https://forums.phpfreaks.com/topic/55266-_post/#findComment-273149 Share on other sites More sharing options...
PhdJB Posted June 12, 2007 Author Share Posted June 12, 2007 Where does this apply at though, in my PHP Variables??? or in each of my forms??? Link to comment https://forums.phpfreaks.com/topic/55266-_post/#findComment-273152 Share on other sites More sharing options...
Wuhtzu Posted June 12, 2007 Share Posted June 12, 2007 That is just a matter of reading up on basic PHP and MySQL... The form: <form action="script.php" method="post"> <input type="text" name="fullname"> <input type="text" name="phone"> <input type="submit value="Submit"> </form> script.php: (part of it) <?PHP $fullname = $_POST['fullname']; $phone = $_POST['phone']; ?> Thats all it takes to get the your "stuff" from your forms "connected" to your PHP code. Now you can do what ever you want with the information by using $fullname and $phone. You could for instance write them to a database like MySQL... Link to comment https://forums.phpfreaks.com/topic/55266-_post/#findComment-273158 Share on other sites More sharing options...
r-it Posted June 12, 2007 Share Posted June 12, 2007 in your php heres what your form looks like: <form name="thisform" method="post" action="process.php"> Username: <input type="text" name="txName" /><br /> Password: <input type="password" name="txPass" /><br /> <input type="submit" name="submit" value="Login" /></form> and your process.php is like this $name = $_POST['txName']; $pass = $_POST['txPass']; //then you do the rest Link to comment https://forums.phpfreaks.com/topic/55266-_post/#findComment-273159 Share on other sites More sharing options...
kenrbnsn Posted June 12, 2007 Share Posted June 12, 2007 Using the super global arrays applies in your PHP script, read the manual page on predefined variables. Ken Link to comment https://forums.phpfreaks.com/topic/55266-_post/#findComment-273160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.