siblood Posted July 15, 2008 Share Posted July 15, 2008 Hi guys, I am really new to PHP. I am experimenting with it as I believe the college I work at can benefit from the technology. I am currently using MS Access 2007 as the backend database although once I get this working I will move it all to MySQL. At present I can retrieve all of the data from the students database and present it in a webpage with the following code: <?PHP $conn=odbc_connect("VEGAS","",""); print('<html> <title>PHP and MS ACCESS</title> </head>'); print('<body>'); print('<table align=center width=90%>'); print('<tr><th>Student Number</th><th>Course</th><th>Last Name</th><th>First Name</th></tr>'); if ($conn) { $sql=("SELECT * FROM Students"); $row=odbc_exec($conn,$sql); while(odbc_fetch_row($row)) { $studentid=odbc_Result($row,1); $course=odbc_Result($row,2); $lastname=odbc_Result($row,3); $firstname=odbc_Result($row,4); print ('<tr><td>'.$studentid.'</td><td>'.$course.'</td><td>'.$lastname.'</td><td>'.$firstname.'</td></tr>'); } } print('</table>'); print('</body>'); print('</html>'); However I want to be able to create a form page which passes the studentid value entered into this php script as a variable which can then be searched (pulled out of the database). Does anyone have any suggestions? (I feel that if I can get an answer to this then it will set the ball rolling for me!!) Thanks in advance and for listening to a newbie. Kind regards Simon. Link to comment https://forums.phpfreaks.com/topic/114811-passing-a-variable-from-the-1st-form-to-allow-it-to-be-used-in-the-php-page/ Share on other sites More sharing options...
jesushax Posted July 15, 2008 Share Posted July 15, 2008 use $VariableName = $_POST["FormField Name"]; that will collect data from your form names and store them in a variable Link to comment https://forums.phpfreaks.com/topic/114811-passing-a-variable-from-the-1st-form-to-allow-it-to-be-used-in-the-php-page/#findComment-590336 Share on other sites More sharing options...
siblood Posted July 15, 2008 Author Share Posted July 15, 2008 Thanks for the quick reply. Should I use this line on the form page? How would I use this within the SELECT statement? Sorry for the questions!! Simon. Link to comment https://forums.phpfreaks.com/topic/114811-passing-a-variable-from-the-1st-form-to-allow-it-to-be-used-in-the-php-page/#findComment-590348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.