Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,841 members, 7,820,929 topics. Date: Wednesday, 08 May 2024 at 03:38 AM

Problem With Checkbox In Php - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Problem With Checkbox In Php (1113 Views)

E-commerce Site In Php With Source Code / Developer Needed with Proficiency in PHP(Yii2)and Dart (Flutter) / Submit Checkbox Values In Form With Jquery (2) (3) (4)

(1) (Reply) (Go Down)

Problem With Checkbox In Php by walterjnr(m): 4:19pm On Feb 01, 2020
please , how can i achieve this in shown in picture labelled "1"

i used this code below and got what you are seeing in picture labelled "2"

<table width="0" border="0">
<tr>
<td width="200"><span class="style3 style3">
<label>
<?php
$sql ="SELECT * FROM tbl_permission";

$query = $dbh->prepare($sql);
$query-> bindParam(':display_name', $display_name, PDO::PARAM_STR);

$query->execute();
for($i=0; $row = $query->fetch(); $i++)
{


?>
<input name="checkItem[]" type="checkbox" value="<?php echo $row['id']; ?>">
<?php echo $row['display_name']; ?> </label>
</span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style3"><span class="style3 style3">
<?php
}

?>
</span></span></td>
</tr>

<tr>
<td><button type="submit" name="btn_save" class="btn btn-primary btn-flat m-b-30 m-t-30">Submit</button> </td>
</tr>
</table>
i want my checkbox to display like in picture labelled "1"

Re: Problem With Checkbox In Php by Thenaijaitguy: 4:57pm On Feb 01, 2020
You can use col-md-3 in bootstrap.

It will divide the row into three .

Let me know if that fix it .
Re: Problem With Checkbox In Php by resosdigital(m): 6:35pm On Feb 01, 2020
You shouldn't be using tables for layouts in the first place. You like use a grid system or css flexbox
Re: Problem With Checkbox In Php by walterjnr(m): 7:09pm On Feb 01, 2020
Thenaijaitguy:
You can use col-md-3 in bootstrap.

It will divide the row into three .

Let me know if that fix it .


How do i use it in my code. Or is my code not correct?
Re: Problem With Checkbox In Php by Thenaijaitguy: 10:27pm On Feb 01, 2020
Your code is correct is just the hmtl and the styling.I can't really explain bootstrap here. Another trick is to use limit in your SQL query

For the first column you can use limit 10
Same with the second column and set offset .
If I'm less busy tomorrow I can write the code and upload on my site for you .
Re: Problem With Checkbox In Php by walterjnr(m): 11:21pm On Feb 01, 2020
Will be glad. Note i am calling the data from a single column.

Thenaijaitguy:
Your code is correct is just the hmtl and the styling.I can't really explain bootstrap here. Another trick is to use limit in your SQL query

For the first column you can use limit 10
Same with the second column and set offset .
If I'm less busy tomorrow I can write the code and upload on my site for you .
Re: Problem With Checkbox In Php by Nobody: 9:25am On Feb 02, 2020
Go learn bootstrap. gerrout of here
Re: Problem With Checkbox In Php by ANTONINEUTRON(m): 2:06pm On Feb 02, 2020
Thenaijaitguy:
Your code is correct is just the hmtl and the styling.I can't really explain bootstrap here. Another trick is to use limit in your SQL query

For the first column you can use limit 10
Same with the second column and set offset .
If I'm less busy tomorrow I can write the code and upload on my site for you .
might still be more complicated..

he should just solve d problem from d frontend.
Re: Problem With Checkbox In Php by walterjnr(m): 10:55pm On Feb 02, 2020
Thanks

ANTONINEUTRON:
might still be more complicated..

he should just solve d problem from d frontend.
Re: Problem With Checkbox In Php by walterjnr(m): 7:59pm On Feb 03, 2020
Still waiting for the code o. Pls


Thenaijaitguy:
Your code is correct is just the hmtl and the styling.I can't really explain bootstrap here. Another trick is to use limit in your SQL query

For the first column you can use limit 10
Same with the second column and set offset .
If I'm less busy tomorrow I can write the code and upload on my site for you .
Re: Problem With Checkbox In Php by Thenaijaitguy: 10:24pm On Feb 03, 2020
Using bootstrap will change your entire front end.
Let's do this .
I believe you have a column with the name $display_name and it contain all the data you want to display.

Let's split them into four column in your database. With column name $name-group1 , $name_group2 ,$name-group3,$name-group4
Re: Problem With Checkbox In Php by Thenaijaitguy: 10:32pm On Feb 03, 2020
In your front end you can do
<tr>
<TD> echo [name_group1] <TD>
<TD> echo [name_group2] <TD>
<TD> echo [name_group3] <TD>
<TD> echo [name_group4] <TD>
</tr>

+234 815 667 8190

You can call me for more clarification
Re: Problem With Checkbox In Php by Thenaijaitguy: 12:47pm On Feb 09, 2020
Here is the solution.

Re: Problem With Checkbox In Php by walterjnr(m): 2:43pm On Feb 09, 2020
Thanks man

Thenaijaitguy:
Here is the solution.

(1) (Reply)

40% Off On Full Stack Web Development (front End And Back End) Training In Abuja / [google I/O] Google Introduces Native Client, Add C And C++ Code Web Apps / How About Nigerian Versions Of This Tech Cos?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 19
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.