Swerve1000 Posted May 4, 2007 Share Posted May 4, 2007 Hi, I'm trying to create a webpage form which will query a database and post the results onto a webpage. I'm trying to write the code for the form:- <form name="searchform" method="POST" action="searchresults.php"> <p> First Name: <input name="First name" type="text" id="First name"> <p><input type="submit" name="submit" value="submit"> </form> Can anyone tell me what the id 'thing/value' is/does? I need to use this I'm guessing for the SQL query. I need to go through all of this stage by stage. Many thanks! Quote Link to comment Share on other sites More sharing options...
btherl Posted May 4, 2007 Share Posted May 4, 2007 id is typically used by javascript or CSS to uniquely identify an HTML tag. It's nothing to do with SQL, although SQL very often has its own ids to uniquely identify a row of data. So although it's "id", it's not related at all to the ids you see in SQL. Its purpose is similar though - unique identification of a thing. Hope that clarifies things! Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted May 4, 2007 Share Posted May 4, 2007 I am not quite sure what your saying, but if you want information displayed that has been inserted by someone else all you need is PHP. Try this coding. <form method="POST" action="searchresults.php"> <p> First Name: <input name="firstname" type="text" /> <p><input type="submit" value="Submit" /> </form> PHP CODE <?php $firstName = $_POST ['firstname']; echo "First Name: $firstName"; ?> This code will take what the person entered on one page and insert it on another page. Now storing the information inserted by the person uses SQL, and thats a whole new set of coding. There is also a way to store the entered inormation, and then recall it when you need it. Like I said, that is all different coding that I am not very familiar with. Good luck finding everything else you need. Quote Link to comment Share on other sites More sharing options...
Ravo Posted May 4, 2007 Share Posted May 4, 2007 EDIT: DJtim beat me to the punch. Quote Link to comment Share on other sites More sharing options...
Swerve1000 Posted May 4, 2007 Author Share Posted May 4, 2007 I am not quite sure what your saying, but if you want information displayed that has been inserted by someone else all you need is PHP. Try this coding. <form method="POST" action="searchresults.php"> <p> First Name: <input name="firstname" type="text" /> <p><input type="submit" value="Submit" /> </form> PHP CODE <?php $firstName = $_POST ['firstname']; echo "First Name: $firstName"; ?> This code will take what the person entered on one page and insert it on another page. thanks for the great help! So to view the results, I need to create a webpage called 'searchresults.php' and use some php code to place the results into the results page form, right? Such as ECHO or something I'm guessing Thanks! Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted May 4, 2007 Share Posted May 4, 2007 Do you want to store results that people will get when they search for something. Or do you want to store what people search for? Like if I search for hello, then my search query will be stored. Quote Link to comment Share on other sites More sharing options...
Swerve1000 Posted May 4, 2007 Author Share Posted May 4, 2007 Do you want to store results that people will get when they search for something. Or do you want to store what people search for? Like if I search for hello, then my search query will be stored. Hi, Don't want to store anything, just want a user's search results to show the matching rows on a page. Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted May 4, 2007 Share Posted May 4, 2007 Yea, for something like that you are going to need SQL, and thats way over my head. Quote Link to comment Share on other sites More sharing options...
Swerve1000 Posted May 4, 2007 Author Share Posted May 4, 2007 You mean SQL queries to get the data from the database I think, going to use PHPMyAdmin to create the SQL, just need to sort my PHP out. THanks! 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.