Jump to content

Recommended Posts

Hey,

 

I have currently made a simple PHP search script which, when data is entered in a text box and it's submitted, it queries a table in a MYSQL database and returns information. This works. However, I want to have a combo box beside the text box with options to query different tables depending on which item in the combo is selected.

 

At the moment it searches a news articles table by content and title. But I want to adapt the script so that it searches another table which holds information on people for example.

 

It currently gets the item from the text box with the code:

 

$v = @$_GET['entered'] ;
  $entereddata = trim($v); 

 

Then queries the database with:

 

$query = "select * from news where content like \"%$entereddata%\" or title like \"%$entereddata%\"  
  order by date";

 

Is this possible to return results from different tables depending on the selection made in a combo box?

 

Thanks,

LJ

 

I'm pretty sure its possible I just don't know how to do it.  ???

 

UPDATED: on second thoughts this might work.

 

<form>
<input type="radio" name="table" value="<?=$table1?>"> Table 1
<br>
<input type="radio" name="table" value="<?=$table2?>"> Table 2
</form>

 

Regards ACE

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.