The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple select box or checkboxes in the registration form
#21
Ok...so if you need to search the entire database at once and you need to be able to search for things that were put in via checkboxes, then I think the best thing is to change those checkboxes from 0 and 1 to unique names for on and off.

Then you're going to want something like this...it's not exact, but it will point you in the right direction.

Code:
if(isset($_POST['search'])){

Code:
$query = Input::get('input');
Code:
$query = htmlspecialchars($query);
Code:
$searchQ = $db->query("SELECT * FROM users WHERE over_18 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}$query{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' OR love_us LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}$query{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}'
Code:
OR am_human LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}$query{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}'");
Code:
$results = $searchQ->results();
Code:
$count = $searchQ->count();
Code:
}

That's the search...then you have to generate your table of results...
Code:
if(isset($count) && $count>0){
Code:
foreach ($results as $result) {

//table of results goes here
  Reply
#22
Thanks Mudmin,

I don't suppose giving the checkboxes unique names can be done by simply changing this:

<pre>
Code:
$over_18 = Input::get('over_18');
    if($over_18 == 'on'){
        $over_18 = 1;
    }else{
        $over_18 = 0;
    }
</pre>


to this:

<pre>
Code:
$over_18 = Input::get('over_18');
    if($over_18 == 'on'){
        $over_18 = over 18;
    }else{
        $over_18 = not over 18;
    }
</pre>


right?

  Reply
#23
Sure... That works.... Just put quotes around your text since you are changing from an integer to string and change your field type from int(1) to varchar(255).
  Reply
#24
Everything works fine now mudmin, thanks so much for your help Smile
I have another question now, but I will start a new thread for that.
  Reply
#25
Great! Glad it's working.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)