Search the Community
Showing results for tags 'checkboxes'.
-
Hi guys, I have a huge problem with inserting multiple checked checkboxes into database and thene display checkones on frontend. In other word i have 2 problems regarding these checkboxes. 1. I have 3 checkboxes into user profile panel lets say checkbox 1, checkbox 2, etc. The user select the first 2 ones and inserts them into database. When he returns to his profile to edit his details, i want to display to the user those 2 checkbox that he selected earlier. 2. The secound problem i have is that i have a weekly calendar with week days and some hour intervals. For this the user must select the hours for a day when he is available and on his frontend profile to display them. This is another thing that i can't manage to do, and want a ideea. A print scrit of this calendar is attached to this message.
- 11 replies
-
- html checkbox
- checkbox
-
(and 1 more)
Tagged with:
-
I want to have completely custom checkboxes and radio buttons. This would entail: 1. a text label 2. a background icon 3. a hover effect 4. an active effect 5. and a click effect I don't want any checkbox or radio icons, I just want them to look like buttons. I have been experimenting with jquery but dont seem to be able to get much further than the default styling. Any suggestions are much appreciated.
- 3 replies
-
- jquery
- checkboxes
-
(and 1 more)
Tagged with:
-
Fairly new to PHP, so I am apologizing up front: Trying to get a couple check boxes to work when going to a MySQL database. They keep coming up "No" no matter what I do: Form Page: <?php if($_COOKIE['newsletter']=='No') echo ' <input type="checkbox" name="newsletterselect[]" value="newsletter" /><label class="Text"> Newsletters by Email </label>'; else echo '<input type="checkbox" name="newsletterselect[]" value="newsletter" checked /><label class="Text"> Newsletters by Email</label><br>'; ?> Processing Code: $newslettersselect[0]='No'; if(isset($_POST['newslettersselect'])){ foreach ($_POST['newslettersselect'] as $value){ if($value=='newsletters') $newslettersselect[0]='Yes'; } } setcookie("newsletters", $newslettersselect[0], null, "/", ".WEBSITENAMEHERE.com"); I have noticed that whenever I change the first line of the processing code (currently where it says 'No', that is the answer that shows up. If I change that to "yes", then I get "yes" in the database every time.
- 2 replies
-
- php
- checkboxes
-
(and 1 more)
Tagged with:
-
Okay, I cant seem to wrap my head around this. I have checkboxes created from javascript var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "checkbox"; element2.name="breakfast[]"; cell2.appendChild(element2); The values are stored in an array and read by a function. The problem I have is on the form side. If the checkboxes say yes, no, yes ... The value no gets skipped and the array contains yes,yes Here is the submit function on the form if(isset($_REQUEST['insert'])){ extract($_REQUEST); if($obj->createMeal($id,'meals')); { //then condition } } How can I handle a checkbox that is not checked and have "no" placed as a post variable in my array?
-
Hey everyone ! First post here and i hope im doing this right ! I've begun to learn PHP and MySQL .. Its going fine untill further but im currently stuck .. What i need is that a user is able to create "tasks".. Those tasks will be stored in a MySQL database table and shown to this user with a checkbox next to them. I've managed to create this, but what i want now is a way to delete those that has been checked after the user clicks a button. I thought this was rather simple but i simply cant figure out how to do it.. Easiest way would be to show you my code.. So here it is: <?php $opgaver_fra_db = mysql_query("SELECT * FROM `opgaver`"); echo '<form method="post" action="opgave_delete.php">'; echo '<input type="submit" value="Slet opgaver" name="delete"/><p>'; while ($chkbx_values = mysql_fetch_array($opgaver_fra_db)) { echo '<input type="checkbox" value="'.$chkbx_values['opgave'].'" name="checkbox"> '.$chkbx_values['opgave'].'</br>'; } echo '</form>'; ?> The above code seems to work great.. A list is shown with checkboxes form what has been created. Heres some code on how to create a new task: $nyopgave = $_POST['opgave_navn']; include 'includes/connection.php'; $tjek_query_opgaver_exists = mysql_query("SELECT * FROM opgaver WHERE opgave = '$nyopgave'") or die(mysql_error()); $opgave_exists = mysql_fetch_array($tjek_query_opgaver_exists); if($opgave_exists['opgave'] > 0) { echo "! - Opgaven er allerede oprettet i systemet!"; } else { $opretopgave = "INSERT INTO opgaver (`opgave`) VALUES ('$nyopgave')"; $opretopgave_query = mysql_query($opretopgave); if($opretopgave_query) { echo "* - Opgaven blev oprettet korrekt!"; include "includes/redirection_admin.php"; } else { "! - Opgaven blev IKKE oprettet korrekt!"; } } This also works great and it is shown in the list that is then loaded when redirected back to the admin page.. The code that loads the list is the code shown first. But heres what i cant get to work .. I need to be able to delete multiple rows when those checkboxes have been selected and a button is clicked.. But i dont know how to do this .. This is the code i've tried so far..: <?php if(isset($_POST['delete'])){//check to see if the delete button has been pressed include "includes/connection.php"; if(isset($_POST['checkbox'])){ //check to see if any boxes have been checked $num = 0;//used to count the number of rows that were deleted $box = $_POST['checkbox']; while (list ($key,$val) = @each ($box)) { //loop through all the checkboxes $num++; $sqldel="DELETE FROM logins WHERE id='$val'";//delete any that match id $resdel=mysql_query($sqldel);//send the query to mysql } //print the logs that were deleted echo"$num record(s) have been deleted."; } else{//no boxes checked echo "No records selected."; } } ?> I dont think this is how you would do it as it doesnt work at all .. Any suggestions ?
-
Hi I am having trouble getting your contact form to use a slight modification with checkbox So far I have the form setup correctly and its is suppose to be a form where users can select between 2 meals and an email will be sent to our chefs so they can know how much to make for the day. I wanted to use an if else statement with php to handle the checkboxes when on person chooses one and not he other the form will be sent if they choose BOTH it will throw an error. Any advice will be greatly appreciated. Thank You Below i have my forms that I am using and would like just a little point in the right direction along with a very cool php tutorial on changing forms Chris Samuelsend_form_email.phpcontactform.htm
- 1 reply
-
- checkboxes
- php
-
(and 2 more)
Tagged with:
-
Hi all, this my first post. I'd like to insert values of checkboxes as a string using a comma as a delimiter. So I have these checkboxes: <input type="checkbox" class="checkbox" name="box[]" value="1">One</input> <input type="checkbox" class="checkbox" name="box[]" value="2">Two</input> <input type="checkbox" class="checkbox" name="box[]" value="3">Three</input> Then I'd have a code like this, which is obviously wrong hence I wrote it for illustration only, it should also have an explode function for the delimiter: if (isset($_POST['box'])) { $newbox = array(); foreach($_POST['box'] as $boxArr){ array_push($newbox, $boxArr); } $query="INSERT INTO boxesTable (boxes) VALUES ('$newbox')"; } Any help would be much appreciated.