Jump to content

Multiple HTML Fields that a user can use, but doesn't have to . . . how do I q..


2tonejoe

Recommended Posts

How do I query on that. They have 7 text inputs that they can enter text into, but they don't have to enter text into each one. I need to query a database on the possible text that they enter. How can I do this? If I leave it as, and someone doesn't type something in one of the fields . . . i am hosed. it returns nothing. Do I have to make a query for each individual possible combination . . ?

 

my query as it stands:

$result = mysql_query("SELECT  `page_number` ,  `ad_name` ,  `book_issue` ,  `io_barcode` ,  `account_number` ,  `book_code` ,  `book_version` ,  `book_type` ,  `clock`  FROM  `ad_info`  WHERE  `book_year` ='$year' AND `book_issue` ='$issue' AND `book_code` ='$bookCode' AND `book_type` ='$bookSection' AND `io_barcode` ='$ioBarcode' AND `ad_name` ='$adName' AND `account_number` ='$account' ORDER BY `page_number` ASC") or die(mysql_error());  

Link to comment
Share on other sites

great. now my issue is that the variables are set. the come across as like

$account = $_POST['account'];

they are printing "yes" in the following statement even if they don't have anything. . .

if(isset($account)){
$WHERE[] = "ad_info.account_number = '$account'";
echo "yes";
}

 

???

Link to comment
Share on other sites

Ah yes,

 

i see the problem. You've created a variable (called $account) and assigned it whatever value is held in $_POST['account'], HOWEVER the index "account" in the POST does NOT exist, however your variable $account is still created, and thus IS set. Use empty() instead.

Link to comment
Share on other sites

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.