The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
multiple select box or checkboxes in the registration form - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29)
+--- Thread: multiple select box or checkboxes in the registration form (/showthread.php?tid=345)

Pages: 1 2 3


multiple select box or checkboxes in the registration form - mudmin - 11-17-2016

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


multiple select box or checkboxes in the registration form - LBC - 11-18-2016

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?




multiple select box or checkboxes in the registration form - dan - 11-18-2016

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).


multiple select box or checkboxes in the registration form - LBC - 11-21-2016

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.


multiple select box or checkboxes in the registration form - mudmin - 11-21-2016

Great! Glad it's working.