search+display from database
I am new to PHP and doing my assigment so I need a little help.
I need to display some informations from SQL database.
Basically, I know the html part, and i made it.
I'll have two inputs, search field, and drop down, and Im using method post, and I need to write independent PHP scripts.
I supose I need two variables, one for drop down and one for search field.
I wonder how to write that correctly in PHP, and how to;
- get results from DB for that two fields
- display them back in my html file
If someone can advise me on this, I'd be grateful.
Thank you in advance!
So, I have DB with countries and area codes, and I need to make search. I wrote html;
<form method="post" action="search.php">
Area Code: <input type="text" name="area">
<input type="submit" name="search" value="Search">
I know the part with connecting to database, but I dont know the method to display right informations for dropdown + search..
Can anyone help?
Thanks in advance..
Use the $_POST array to access the form inputs. (See http://www.php.net/manual/en/languag...s.external.php.)
Then read up on whichever database extension you plan to use for the specific RDBMS you'll be using.
I made $country = "$country" and then queryied db for column that is %like% $country, echoed results in the end..
And now Im stuck with the client need to remember drop down selection..
I wonder if it can be done with php?
See the $_SESSION super-global array along with the session_start() function for retaining values across pages by the same user.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)