Dynamic Tables And Checkboxes
I am creating a table that will allow users to simply check a box and then have whatever they checked be displayed on another page...its not going as I planned. Here is what I have so far:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Checkboxes
I am doing a structure of booking on line, and now I Have to make this: when anybody books a place (checkbox) it is inserted in the database (column posti) and it must change from a check box to an image PHP Code:
Updating A DB From Dynamic Checkboxes
I have set up a database as follows: 1 table called screen1 with 2 fields: ID and status I have code to create a HTML table that checks each status entry for every ID (ID is an auto_increment primary key) and depending on the value of status (whether it is 1 or zero) the code will output some HTML code. This is for a cinema booking system. I have check boxes so that a user can tick eg: 5 checkboxes and book those 5 seats without having to go back and click a link and book it 1 seat at a time (the way i had it before) However, I cant get this working properly with the checkboxes. here is the code I have so far: Code:
Update Dynamic Checkboxes
I am creating a small e-mail system, where the user can create a various number of e-mailgroups and from another form the user can assign e-mailaddresses to the groups. First I put the names of the groups into a MySQL table "emailgrouptable" - at the same time I alter another table "emailaddresstable" with the (new)names of the groups. From the page where the user can add new addresses the names of the groups are presented dynamically based on the table "emailgrouptable" first I get the names of the groups and the total number of the groups. Code:
Checkboxes And Dynamic Queries
I have a slight problem with a project i'm working on. It involves users checking 2 lots of checkboxes. The first section is, for example typeofinjury and the second is an area of the UK. The typeofinjury is an individual table in the database. Below is what i'm looking to do: Part I _ |_| CarAccident _ |_| WorkInjury _ |_| ColdFlu _ |_| Other As you can see I have 4 checkboxes that signify the typeofinjury. Part II _ |_| Scotland _ |_| Wales _ |_| Ireland _ |_| England The second part is the areas in which i need to be able to search. This means that If in Part I, CarAccident and ColdFlu are checked and then Scotland and Wales are chosen, the following should happen: All postcodes related to scotland and Wales are queried in table CarAccident All postcodes related to Scotland and Wales are ueried in table Coldflu I then need to calcuate how many results from CarAccident there are, with postcods of Scotland and Wales and also how many results are in coldflu with postcodes from Scotland and wales. but i could do this once I know how to do the rest. I know this may seem slightly complicated, but I have no idea where to start. I've looked around and all I've found is how to create the checkboxes: Code:
Updating DB With 2 Different Sets Of Dynamic Checkboxes
I have a form which includes a text field which displays a date, and 2 different sets of checkboxes generated dynamically from MySQL. One set of checkboxes lists courses, and the other displays a set of names. Now the purpose of this, is to fill in a date in the text field, Check all or some courses for select individuals to take. In other words, it schedules courses for select individuals to complete by a certain date. I want to know how can I submit the checkboxes to a DB table named schedule which contains fields, for date, course#, and employee#. heres is some code that i used to display the checkboxes. These are assigned values from 2 other tables named Courses and Employees. PHP Code:
Dynamic Checkboxes From Mysql Table
tearing my hair out over this! I have 2 tables: PTable which lists all traits pid,ptype 1,good 2,bad 3,neutral UserP Table which records user and traits uid,pid 1,2 1,3 9,1 9,2 9,3 For a certain user UID, how can I get php to automatically create html checkboxes listing ALL traits from PTable and check each trait based on the UserP table on a webpage? Hence, if UID is 1 it should show good - unchecked bad - checked neutral - checked
Selecting Multiple Dynamic Checkboxes From A Database
I have dynamic checkboxes with values populated from a database table and want to set the boxes to selected based on values from another table. Basically, I have a table of users, a table of categories (populates the checkboxes) and a table that is populated when multiple categories are selected per user (the table used to set the checkboxes to selected)..hope this is clear..Its for an 'Edit user' page, displaying the info for the user. Code:
Dynamic Php Tables
As you'll notice, each new result appears in a new table, which is very annoying. I am trying to make it so that all ther results appear in 1 table. This is what I have so far; <? //error message (not found message) $XX = "No Record Found"; $query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%' LIMIT 0, 30 "); while ($row = mysql_fetch_array($query)) { $variable1=$row["Model"]; $variable2=$row["Creator"]; $variable3=$row["Title"]; print ("$variable1, $variable2 ,$variable3"); } //below this is the function for no record!! if (!$variable1) { print ("$XX"); } //end ?> Can anyone help please?
Dynamic Tables
I am creating a dymanic website generator in php/mysql and I have a particular question. I have the following sql statement: $sql = "CREATE TABLE one ( Email CHAR(50) NOT NULL, First_Name CHAR(25) )"; and it works just fine. I need it to act dynamically and vary with different contents that are being submitted by a form. In short, I need the name of the table that is being created to be a variable and not a static name. Here is an example: $sql = "CREATE TABLE $wstitle ( Email CHAR(50) NOT NULL, First_Name CHAR(25) )"; Can this be done in any other way that the above example because it does not work.
Counting In Dynamic Tables
I have a question that i think will be pretty easy for someone 'in the know' to answer, but as of yet i have been unable to find anything on google. Basically, i have a page that is an overview of a shows reservations. On it i have a dynamic table that shows all the nights in the system for a particular show. I'd like one of the fields on each row of the table to display the total of reservations made for that night. So each row would display the total reservations (i.e. rows in the related table) for the night it refers to, much like a message boards 'replies' count.
Selecting Multiple Values From Multiple Tables Using Checkboxes
I've been struggling with this for a bit but cannot seem to find a simpler, cleaner way of doing this. a. I have a Table A - Customers , Table B - Contacts . b. I have a form where a user types the first few alphabets of a customer name and then gets a list of contacts, cities. c. The user is supposed to select multiple options from this list and then send that data to another form for processing. I'm able to only pass data from Table A, not from B . Could someone please have a look at the 2 snippets of code and advise? And is there a way both these php scripts could be combined in a single one ? Code:
Generating Multiple Alternating Columns And/or Tables Within Tables
I am having a little bit of trouble generating the code for a table with 2 columns. The columns contain tables within themselves. Not sure why as that part was an existing design. Here is the output so far and it is correct but not how i want it to be (i'll explain) Code:
Checkboxes
I've got a form with multiple checkboxes (1-1000 depending what you get from database), and all of those checkboxes are named with an unique id: $Id. What I wanna do is when the form is submitted, all of the rows where checkbox is selected will be updated. I know that it's done by UPDATE TABLE SET Field = 'New Value' WHERE Id IN (1,2,4,8...) But how can I read what checkboxes are checked, when the name of the checkboxes are changing?
Checkboxes
I have a form with 3 checkboxes wich have all the same name: <input type=checkbox name=test value=val1> <input type=checkbox name=test value=val2> <input type=checkbox name=test value=val3> now on the target page i need all values that are checked, so if they are all 3 ckecked i need to get val1, val2 and val3 on the target page. With ASP you get the varaible test = val1;val2;val3 (the values are all put in one variable, separated with a ";" But when i use PhP i only get the last value in this case "val3". What do i need to do to get all values? I have named them all the same because those checkboxes are dynamicly generated. I dont know how many there will be.
Checkboxes
I have a two checkboxes in HTML: <input TYPE="checkbox" NAME="cc" VALUE="true"></td><td><b>Credit Card</b></td></tr> <input TYPE="checkbox" NAME="cash" VALUE="true"></td><td><b>Company Check</b> <input type=button onClick='<?php reviewpayment()?>' value='Continue' style='font: 10pt Arial; The function works if I type into the function $cc = true; $cash = false; <?php function reviewpayment() { $validity = TRUE; if ($cc && cash) { echo 'javascript:alert(" Please select ONLY ONE type of payment ");' $validity = FALSE; } .................... ?. Therefore the function is not receiving the input from the check boxes. How do I structure the script and HTML to send the input cc and cash in HTML to $cc and $cash in PHP?
PHP Checkboxes
How do I send CHECKBOXES via email through the mail() function in PHP? Example: You have 67 checkboxes, all with unique names, but only want to send the ones that were checked. Mailer: Verifies only 2 of those 67 were checked, so the email only has 2 checkboxes checked.
Checkboxes
I have it so a user ticks checkboxes with what 6 numbers they chose, and i need it to check it with a list of 12 numbers and when they press submit, if they got any correct, its says how many they got right. I laso need it to say if someone has selected more than six options. The checkboxes id are the numbers, ie checkbox1, checkbox2, checkbox3 etc up to checkbox20 Code:
Allow Only 3 Checkboxes ?
How can I limit number of maximum selected checkboxes to only 3 if I have total of 10 checkboxes? I need to limit to 3 answers in poll that have 10 answers. I use the following to print checkboxes: PHP Code:
Checkboxes
I'm trying to construct a checkbox array in a survey form where one of the choices is "No Preference" which is checked by default. If the victim chooses other than "No Preference", I'd like to uncheck the "No Preferences" box and submit the other choices to the rest of the form as an array. I have most of it worked out, but I'm stuck on an apparent disconnect between php and javascript. When I use this code:
Checkboxes ...
I was wondering how to run a query for every check box checked, Ive looked around the net and nothing I've come accross is too usefull.
PHP And Checkboxes
<input type="checkbox" name="approved" id="approved" <?php if($f['enabled'] == "1") echo "checked="checked""; ?>" /> it saves it as a boolean in the Db.. how do I set the bool in the DB?
Checkboxes
I have been trying to learn checkboxes and arrays, and I've finally figured out how to add the checkboxes to the database. I currently have two forms addlinks.php and modifylinks.php and I have a dolinks.php that submits my data to the database. What I would like to do now is on my modifylinks page show a tick in the boxes to show that they have already been added. At the moment if I dont tick any boxes on modifylinks.php it deletes my previous data, and I have to retick them everytime I do an update. Code:
Checkboxes
I have a contact form that has about 15 checkboxes on it for different interest. I am curious on the best practice for setting up my mysql table to store the info from the form and how to check which one is selected /checked
Checkboxes From A Mysql DB
I'm creating a page that includes check boxes that are dynamically pulled from a MySQL database. I have gotten it to correctly pull up the boxes and name them, but when I make a change and submit, all of the values that were checked are set to 0 instead of 1. This should print out a checkbox, checked if it is supposed to be, and take an argument to be passed when the user chooses to update the page. When I submit my form, all of the checkboxes pass a value of zero even when they are checked. Can you tell me if there is an error in this statement? print "<td valign='top'>"; print "<input type=checkbox name=checkbox_$cat_name value='checked' $checked[$j]></td>"; print ${"checkbox_".$field_name}." !!!"; print "<td valign='top'>$list_cat_name</td>"; $checked[$j] - contains the value 'checked' or nothing set (correctly) earlier in the file the checkboxes are named checkbox_(fieldname) [ex: checkbox_food] The value 'checked' is passed to another file that updates the db.
Cycle Through Checkboxes
I am fairly new to PHP and ran into a problem that I am sure someone can help me out with. I have a list of email addresses that I am pulling from mySQL, and printing them in table rows with checkboxes in front of each row so that the user can select the address to be deleted from the DB when the user clicks submit button. I am naming each checkbox "c_<email address>". The output works fine. The problem that I am having is, how do I make PHP cycle through each of the checkboxes to check to see which one or ones are checked?
Checkboxes, Arrays And SQL
I am very new with PHP, so I hope someone can help me: With the help of JPJones, I've managed to write a basic search script querying a MySQL database. I would like my users to choose which fields they search from, eg search for "red" in field1, field2 and field7 only. I would use checkboxes for this, using [], eg: <input type="checkbox" id="field[]" value="field1">Field 1 I understand I would have to split the $field array (on the comma delimiter?) and then use it in my SQL statement. Would it be something like this? foreach($fieldarray as $key=>$value) { $sql = "SELECT * FROM table WHERE $fieldarray[i] LIKE '%$searchword%'"; } I have no idea of the correct syntax.
Setting Checkboxes
I have a script which iwant to use to check some check boxes based on a query. It does not work partly because some of the code is borrowed and because I'm abit of my depth. PHP Code:
Checkboxes - Implode
This is my situation: I have an html form that has 4 checkboxes. <p><input type="checkbox" name="area[]" value="1" checked> Area1<br> <input type="checkbox" name="area[]" value="2" checked> Area2<br> <input type="checkbox" name="area[]" value="3" checked> Area3<br> <input type="checkbox" name="area[]" value="4" checked> All other areas</p> This array is passed to a php page that runs a query on a mySQL table. The possible values for area in the mySQL table are 1, 2, 3, 4, 5, 6. So, I want to display records that match the appropriate checkboxes except if checkbox 4 is checked I want the value to be 4, 5, and 6. (>=4). I just can't get the implode to do this. The problem is the last. If checkbox 4 is checked it displays records with area=4 and doesn't display records with area =5 and area=6. How could I do this?
Checkboxes And Sql Row Results
I am trying to place a checkbox beside each row that is inputed into the database. Now this is how I diplay the rows: print "<br><br>There are $num_rows records.<P>"; print "<table width=500 border=0> "; while ($get_info = mysql_fetch_row($result)) { print "<tr> "; foreach ($get_info as $field) print " <td><font face=arial size=1/>$field</font></td> "; print "</tr> "; How would I go about attaching this: <input type="checkbox" value="..." name="..."> to the side of each displayed row? Also, how would I assign the row id to the checkbox so that once the box is check and the action initiated the row would be deleted?
Table And Checkboxes
i have a table which basically just displays all the stuff out of a database and a check box at the end which i want 2 be able to if the checkbox is checked update and set broken_links = Ɔ' for that id, i can get it 2 change 1 but i want to be able to click like 10 checkboxes and it changes broken_links to 0 for them all Code:
Form Checkboxes
I have a form, a very long form of checkboxes. what I want is the values of these checkboxes that are checked to be queryed on a MySQL database. I'll display some of my form so you get the idea of what it looks like also the url to it so you can check it out fully. Code:
Sql Query From Checkboxes
I'm having a Mysql database with two tables, one table person containing the personal information, and another table profile, with several columns that can be either y or n. As it is now, from a html form I can enter information in the database, and I edit a persons personal information and profile. But now I want to be able to find persons based on their profile, so I have a form with a checkbox for each column in the profile table. I want to be able to check off one or more checkboxes, and get the names and id number for the corresponding persons. But invariably I get all the persons in the database as a result. Even when I _don't check any boxes_! I include the code snippets here: Code:
Count Of Checkboxes (again)
I'm still stuck with this problem. Here's a quick recap/summary :- 1. Page 1:User checks 3 out of 10 checkboxes and submits form to page 2 2. Page 2:Item count shows 3 items. User checks an additional 2 checkboxes and presses Update button. Item count now shows 5 checkboxes are checked and "New" checkboxes remain checked. 3. Page 2:User is happy and submits form to page 3 4. Page 3:Form items are converted into printable text/data Pedro Graca very kindly offered a solution using "header('Location: <URL>')" which very nearly worked however my problem is that the form data needs to be posted to the page 3 when the user is done (if not for this then the solution was perfect). Using header() does not post the data and from what I have read elsewhere there is no way of making it do this. I can think of a really ugly solution by way of changing the form's action to page 3 the first time the Submit (to page 3) button is pressed and tell the user to press it again to get to page 3 but I don't like this much. By the way, I really would prefer to avoid JavaScript.
While(list => Checkboxes
I wanted to print out checkboxes for those which are checked when form is being submitted. Whilst, this is my function: PHP Code:
Forms And Checkboxes
I need some help with manipulating form vars, in particular checkboxes. I currently have a form setup that dynamically creates X number of checkboxes, all named "accept_check_X" where X is the index # of that record from the DB. When I submit I want to be able to check the status of each checkbox to see if it's set to on or off. Right now I'm using $_POST, but it doesn't seem to contain the checkboxes that were left unchecked. It just has the checkboxes that were checked and submitted. Is there anyway I can check the status of all the checkboxes from the previous page?
Depending Checkboxes
I have one MySQL table from where I pick project names and then list them in a combo box (menu). Depending on what project a user would pick he would then pick a task, that exists in that project (another table for projects). Concept is quite simple but very hard to implement since internet is stateless. The simplest way would be to pick a project from the first combo box. Depending on what project I would pick the content of task combo box would be adapted. Maybe this could be done with javascript but I don't know how. Maybe I should forget this concept and do it with step by step picking. New page for each pick.
Checkboxes Php & Javascript
I am generating a set of dynamic checkboxes via php. I have to check that the uer should atleast check one checkbox. When there are more then 1 checkbox my javascript works but if there is only one check box then my javascript doesnt works. My code is <script> function deletecheck() { for (i=0;i<document.form.elements['projectChecked[]'].length;i++) { if(document.form.elements['projectChecked[]'][i].checked==true) { return true; } } alert ("Please select a project to delete"); return false; } </script> <form ......onsubmit='return deletecheck();'> <?php foreach(.....) { echo "<input type='checkbox' name='projectChecked[]' value='".$projectName."' >"; } ?>
Processing Checkboxes
If I choose more than one item in a checkbox list, PHP feeds back only the last choice. Why? For example, I select 'dogs', 'cats' and 'mice', it sets the variable to 'mice' only.
Handling Checkboxes
i have some problem handling with checkboxes when i try to insert a record.It returns no value. For example, if the student is enrolled to a course, i check the box and i want to store the value 1 and if the student is'nt enrolled, i leave the box empty. Well, i placed, if ($stdenrol=="") $stdenrol=0; before my insert st. <INPUT type=checkbox name="std_enrol" value="1"<? if ($stdenrol==1)echo "checked";?>> So, I think if the checkbox is checked, it returns a value "1" to the table and if it is not checked, it returns a value "0". If i check it and try to insert, it does'nt produce me any error.If i leave it empty, it produces me an error,"conversion error from string." How can i fix this error. This column can also accept null values.
Checkboxes,conditional
Basically I have what seems to be a very small problem but I am driving ny self mad trying to figure out what the problem is. Here is what I have: I have a form with two checkboxes: <input type="checkbox" name="medicalcheck" > <input type="checkbox" name="dentalcheck" > the form is posting the a php file, decision.php, that simple checks to see if the boxes have been checked and performs an operation in either case. Here is the code:
Using Checkboxes Instead Of A Link
On my site I give users to option to subscribe to certain articles. When they choose to subscribe the necessary addition is made to the database. When they go to the Unsubscribe section it lists the articles that they are subscribed to and gives a link next to it letting them unsubscribe. However, rather than having the text, I want to have a checkbox instead. Then I want to have a button at the bottom that when clicked unsubscribes them from any articles whose checkbox is ticked. This is similar to the way that My eBay works, if you are still unclear.
Multiple Checkboxes
I am OK using php to process ARRAYS of checkboxes BUT how on earth can you process multiple checkboxes with the SAME name WITHOUT using arrays ? For example ... <input name = "check" type = "checkbox" value = "'value1'"/> <input name = "check" type = "checkbox" value = "'value2'"/> <input name = "check" type = "checkbox" value = "'value3'"/> as opposed to ... <input name = "check[]" type = "checkbox" value = "'value1'"/> <input name = "check[]" type = "checkbox" value = "'value2'"/> <input name = "check[]" type = "checkbox" value = "'value3'"/> The problem is that you cannot use checkbox arrays (of the form check[]) in javascript. There seems to a conflict of interest here ?
Hide One Of The Checkboxes
is there any way that i would be able to hide one of the checkboxes if it is pulling from a database. Here is the scenario in my website i have all of the different regions (of my website) listed from 1 - 6 on the database. I have just recently made it so that the users can post in different regions other then the old just one region. My problem is that there is an all in the database table. Normally i would just get rid of it but it would void out all of those posts with the region selected as all. What i need to do is hide or get rid of that all without hurting the web site. Is there any way to do that? here is my code:
Deleting Using Checkboxes
im wanting to delete multiple things from a database using checkboxes, now i know how to use checkboxes in php etc. my question is would this be done using a basic while loop? i mean would i query all the things and then do while ($check_box == 'ON') { do the delete script } or is there something more to it?
Checkboxes In Arrays
I have a webpage that I need to collect information from and pass on to a result page. The initial page lists product categories from a MySQL database and the result page should show the price list for those selected products. My problem is that I don't want to create an individual item for each category. It should be done dynamically so that as the databse is updated, the webpage is automatically updated. I also want the page to be formatted in a certain way. I need to have checkboxes out beside each dynamically "pulled" product category so that the end-user can select which products they would like to see a price list for. I am able to get the list to print on the initial screen just like I want, HOWEVER, with the way I've set it up, the checkboxes all have the same name, and therefore can't pass unique data to the result page. How can I make the checkboxes "automatically" be assigned unique names when they are part of an array of other information? Here is the code that I'm currently using: Code:
Checkboxes And Emails
I am trying to build a form that changes the email addresses depending on the checkboxes that are checked. I am at a total loss getting multiple checkboxes to populate the email variable. I'm not sure if the checkboxes need differing names or the same name. I get an error that says checkboxes with the same name needs to be in brackets[]. With different names I can't get anything to work.
Looking For Advice: Checkboxes And Mysql
I am currently working on a project, and I need some advice on a couple of things. I am working on a system that displays records from a database. I have included a checkbox beside each record that is displayed, and the idea is that when the user selects the check box and hits submit, the record will disappear from the list of records, but must not be deleted from the database. So my main question is what kind of field will I need to add to my database? Some sort of field that has true/false setting? And from this I take it I must perform a check to see if the record is true or false in order to determine whether or not to display it? Code:
Checkboxes And Next/Prev Buttons
I am having this problem i cant understand it. I have been able to create this perfectly working script to output results from the database dynamicly. Each record has a check box next to it so i can select if i want to delete it. I am showing 20 records per page. Here are the main problems : 1) The numbered pages are shown however the next / prev links that i have created are not outputted. 2) How can i make it delete the selected record/s after pressing submit which i tried to place but it isnt showing up for some reason :-s. And this is a challenge / extra one for me at least : 3) How can i can i make it remember from one page to another what to delete ? shall i used session if so how to implement them ? Code:
|