User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,301 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,812 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

php drop down menu to search multiple sql tables

Join Date: Jul 2004
Location: Arizona State University
Posts: 56
Reputation: bwest is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
bwest's Avatar
bwest bwest is offline Offline
Junior Poster in Training

Re: php drop down menu to search multiple sql tables

  #4  
Jul 27th, 2005
Hi Lawfour

Ok the first thing is I think your ready to move on to hand-writing your php instead of using a tool to do it for you. The people in this form are great and we can answer almost any question you have. -And while writing by hand might take a while at first you will eventually generate many methods and algorithms that you will re-use over and over so things will eventually become less frustrating.

Ok, here is how you will need to do form submission for now on. The mail() method simply wont work.

Make a form like this

[HTML]<form name="thisForm" method="POST" action="process.php">
<p><input type="text" name="my_textbox" size="20"></p>
<p><select size="1" name="my_dropdown">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select></p>
<p><input type="buttom" value="Submit" name="btm_submit" onclick="validate()"></p>
</form>[/HTML]

Notice that the submit button is not a type="submit". We are going to call a javascript function called validate first before we potentially send off bad info to the php page. the function looks like this

function validate() {

fm = document.thisForm

//use validation here to make sure the user entered
//the information correctly

fm.submit()

}


Notice that the form has an action="process.php". That means that there will be $_POST variables available to you in that php file. When the user hits the submit button and the javascript sends the form, the browser will re-direct to process.php

Here's what that page might look like

[PHP]<?php

echo $_POST['my_textbox'];
echo $_POST['my_dropdown'];

//The name of these post variables is the same as the name
//of the elements that were in the form

?>[/PHP]

Now, Let me know if your have grasped all that and if you respond (in otherwords if you have looked back on this thread which some people dont even do). Then perhaps Troy and I can help you with the database and dynamic form part

On a side note. If you would have used method="GET" in the form, you would use $_GET[] in the php

-B
Reply With Quote  
All times are GMT -4. The time now is 9:59 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC