Dynamic Checkbox List - DB Update
I have a set of questions which are being dynamically output:
for($i=0; $i<count($question_array); $i++)
{echo $question_array[$i][question] .
"<input type='checkbox' name='question_" . $question_array[$i][id] . "' value='Y'' . "><br>";}
I then want to update each question in the DB. I want to loop through each question id and carry out the relevant action (either enable or disable). What is the best way to do this?? As I am dynamically generating the variable name (e.g. question_50) what is the best way to loop through these updating the relevant id?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Update Column With Checkbox
I have a basic page that shows a basic table of the database (names, address, number of tickets purchased.) I also just made a column with a checkbox. I would like to be able to check a number of boxes and probably hit a update button or something like that and have it UPDATE the DB by adding now() into the MailedTickets column for the multiple rows that I checked. PHP Code:
Generate Checkbox List
I have a table with two fields: 1) groups_id 2) groups_name The data contained is simple: groups_idgroups_name --------------------------- 1 Group A 2 Group B 3 Group C 4 Group D I would like to dynamically create a checkbox selection similar to: <input name="sel_group" type="checkbox" value="1">Group A<BR> <input name="sel_group" type="checkbox" value="2">Group B<BR> <input name="sel_group" type="checkbox" value="3">Group C<BR> <input name="sel_group" type="checkbox" value="4">Group D<BR> So I need a script that'll take this information from the groups table and create the above.
List All But Echo In Checkbox Only Selected
There is a 3 table: I want to list all the product groups but to be checked in checkbox only what choose the user. If from outside (choos.php?tt_reg_id=1) user is nr 1 then in listed checkboxes need to be checked only those checkboxes what the user nr 1 choose / but listed the all product groups. Code:
Dynamic Web Pages Using The Checkbox Component
I am trying to create a page where my users choose from a list of topics with a checkbox, then have a page generated from the topics that they have chosen. How do I go about doing this or where I could find the script for this.
Problems With Dynamic Checkbox - Need To Create Array
The problem I have concerns a dynamically created table/form which pulls in results from a user search of a mysql database. This works fine and pulls in results (title/author/isbn/price) and dynamically creates the table dependent upon how many results are found. For each result there is a dynamically created checkbox, which is bound to a unique field from the database(in this case isbn). My problem then is: the dynamically created checkbox submits an isbn value to the next page - an order form. However I need that a user can select a number of checkboxes from the table. At the moment, each selection overwrites the other. It may be vary obvious - but I need to work out some way of storing the checkbox info in an array that gets submitted to my order form page. at the moment the code for my checkbox within the html form is: <input name="isbn_input" type="checkbox" id="isbn_input" value="<?php echo $row_Rs_panozzo_search['isbn']; ?>" /> </font></td> This works passing one value through to my order form, but I need to set it up so it passes multiple values.
Ajax - Dynamic Update
I would like to request some data from a server using ajax (search type of thing). Whilst the server is searching, I would like to display the first results on the client side. Ideally as they come in. What is the best way to go about such a search?...
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:
Dynamic Form Update
I have the following form in which i need to updateitems. The problem is that i do not know how many elements will be in the form (generated dynamically) eg <input type = "hidden" name ="id1" value="1"><input type ="qty1" value ="1"> <input type = "hidden" name ="id2" value="2"><input type ="qty2" value ="1"> <input type = "hidden" name ="id3" value="3"><input type ="qty3" value ="5"> <input type = "hidden" name ="idn" value="n"><input type ="qtyn" value ="1"> how do i generate an array for a foreach loop to update the values in PHP so that i can use it to create a Update query eg ///begin loop $sql = "UPDATE `table` SET `qty` = `$qtyn` WHERE `id` = `$idn`"; // end loop
Dynamic Update/insert Statement?
I'm hoping to build a dynamic sql statement for inserts and updates based on FORM values. I've done this in ASP but not sure about PHP syntax. Right now I just output the form entry results, but here's what I'm thinking for an update: PHP Code:
Php Mysql Update - Echo Not Updated List
I have 2 tables, "Inventory" contains a few details about the shop items, "Shop" contains all the information. I'm doing it this way because the information is coming from a csv on another server. So I'm looking for a way to update item quantities between the tables, then echo/print any records that don't exist yet to be updated. Then I can manually add any new records to my shop database and it will update as usual next time. Anyway, here's what I have so far, but it doesn't display my extra records. Code:
Update A Ststic HTML Form To Dynamic
I have a form which I now want to be more dynamic. The datbase tables are builtbut I cannot get the fields to populate. When a member selects an age group from the first select statement and the dates that age group are scheduled to play a match are displayed in a second select statement. When both select ions have been made the rest of the form is displayed and can be filled in and the database updated. Code:
A Dynamic Drop Down List
I need to create a dynamic drop down list. By this i mean that the webpage html form = select style will recieve all the values as based on a query to a mysql database. I have no problems quering the data base with PHP, But i need to make some kind of for loop that will add a new value to the selct form for each result from the database. my thought process go like this. 1. call data base to guery. (no problem) 2. make variable variables that will be created according to the number of results (these variables must be created according to results of query, not a problem i think) 3. make a form like this <form action = ***** method = post> <select name = ******> <option value = "This is a query result"> This is a query result> //This is the part i need to using a for loop and variable variables </select></form> so my problem is part 3, cause is this all done in PHP, or if i had all these variables, can i do this in HTML? Can i make a for loop in PHP that would break into HTML during these parts?
Dynamic Mailing List?
I have a schedule of people that need reminders sent to them weekly. I have figured out how to set a Crontab to send the reminder automatically ... but the people are not the same every week. I know that I could build multiple scripts and hard code the email addresses, setting a cron job for each - but is there any way to build ONE script that will read a text file based on the date and pull the names/email addresses off of that?
Dynamic List Order
I was trying to get the list box to display the id numbers in ascending order however the code below does not work, just wondering how to fix it? <?php $g = "SELECT * FROM em ORDER BY iD ASC"; $q = mysql_query($g, $link_id) or die(mysql_error()); if (mysql_num_rows($q) > 0) { ?> <select name="d"> <?php while($r = mysql_fetch_assoc($q)) { ?> <option value="<?php echo $r['Id']; ?>"><?php echo $r['Id']; ?></option> <?php } } ?>
Dynamic List Population
how do you populate a list dynamically? for example I have the following in a table but I can't get them into the list after the query is performed. <form action=""> <select name="cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="fiat">Fiat</option> <option value="audi">Audi</option> </select>
Generating A Dynamic List
I am tying to write a statement that will compare the values of 2 columns, and display the result in a temp table. ex. Table A has the following columns: "Minimum" and "Maximum." The temp table will hold the reult of the difference between the 2 columns of table A. Scope: I am trying to crate a drop down with the resulting data as it is incremented. If Min = 2 and Max = 7, the TEMP tab;e should get the results of 2,3,4,5,6,7. I want to have this result displayed in a drop-down list.
Dynamic List Items Repeating Themselves
I'm working on this online magazine, and each page (well, other than the front page) has a menu included on the right-hand side consisting of articles divided into three sections: articles, columns, reviews. For some reason, whenever I click on one of these article links, that link takes the place of the first link in the section. You can see what I mean here: PHP for the included right_menu.php PHP Code:
Dynamic Drop-down List In Array
Q. How do I create a dynamically-generated drop-down list for use in an array. I'm using PHP with a MySQL database (through phpMyAdmin) My database table is called com_courses, and I want to pull the distinct 'title' fields and have them appear as a drop down menu for the user to select in a form. Here is my array, with (at the moment) manually-entered 'titles' (which I now need to be dynamically generated from my database field: 'com_courses.title' array ( "coursetitle", "Course Title:", $EXTRA_SELECTLIST, array ("Report Writing", "Recruitment & Selection", "Presentation Skills", "Essential Telephone Skills", "Time Managememt", "Customer Care", "Other"), 0 ), I am not an experienced programmer, but can play around with php to customize programs. I've read up on arrays (I bought a "Programming with PHP and MySQL" book, but it just stops short of this problem). I can't figure this one out.
Dynamic Form Option List
I want to create a dynamic drop down option list in a form, but I just can't wrap my head around this. Both of the below scripts work as intended, but how do I make the mySql query results work with my existing script? Yes, I know I must replace the "$options = array" part in the top piece of code, but I need a little more guidance than that. Code:
Searching Dynamic Driven List
I have a members database will all their personal details in. I have a page running a SQL query to display a complete list of all these people. This is what my query looks like: $sql_prop = "SELECT * FROM $db.members WHERE area = '".$_REQUEST['area']. "' ORDER BY name ASC; $result_prop = mysql_query($sql_prop) or die(error_report("Mysql Error", mysql_error()." $sql_prop", $_SERVER['REMOTE_ADDR'])); "Error Report" is just one of my functions. I have two forms fields on this page, "Name" and "Address". I want to be able to search the listing that this SQL query has returned for those fields, ie. the user enters "John" in the form field and it returns all entries within the query matching "John". The reason I'm using this: area = '".$_REQUEST['area']. "' in the WHERE clause, is just to ensure that the person viewing this list can only see members that are in his area. On the previous page there is a piece of code that gets the session "area" and brings it across to this page. I'm keen on keeping that code in. It works for me at the moment. Any ideas? How can I search this already filtered list?
Dynamic Form - How To Set Values Of A List
I have a form with a list/menu in it that is populated with records from a database. The items in list#2 are based upon what is selected in list#1. I have been able to use a combination of php and javascript to get it to work, but the javascript reloads the page to get list #2 to refresh - and that clears out any other fields that have been filled in. Instead of javascript being called for the 'onchange' event for list #1, I'd rather it call php when list#1 is changed and so reset the values in list#2. OPTIONS: 1. I thought I could have a php function that is called (i.e. onchange="<?php reload();?>" but I can't figure out how to set the values of the list from within the php function. How to reference form objects with php?
Dynamic List Populated By MySQL Table
I am building my first php page and I've ran into problems trying to create a dynamic drop down list for an INSERT page. My page is based on this example from mysql.com. I want to populate the list from a table in MySQL, but when I test the page the list only contains the first record. If anyone can help me out, or recommend an easy way to create dynamic menus/lists, I will be very grateful. This code appears above the FORM ACTION: $NearMajorCity = mysql_query("SELECT NearMajorCity_ID, NearMajorCity FROM NearMajorCity"); This code is within the FORM: <SELECT NAME="NearMajorCity" SIZE=1> <OPTION SELECTED VALUE="">Select One <OPTION VALUE="">--------- <?php while ($NearMajorCity = mysql_fetch_array($NearMajorCity)) { $NearMajorCity_ID = $NearMajorCity["NearMajorCity_ID"]; $NearMajorCity = $NearMajorCity["NearMajorCity"]; echo("<OPTION VALUE='$NearMajorCity_ID'>$NearMajorCity "); } ?> </SELECT> I want to be able to view the names of the Major Cities in the list, but I want the NearMajorCity_ID inserted into the table.
Member Area With Dynamic File List
I have an Apache 1.3.31 with PHP 4.4.1 available and want to create some kind of "member area" with a per-user or per-group listing of files that can be downloaded. How would I do this? At present I just protect the individual files using .htaccess and .htpasswd files and give out direct URLs to the files together with username/password. What I'd like is some login functionality where people can log in using their username/password and then find a list of files they can download together with additional information individually tailored for that user.
Dynamic Drop-down List With Array - Question
Can anyone out there give me a pointer regarding creating a dynamically-generated drop-down list connected to an array? And is that question as clear as chocolate spread? Here's what I've got. I'm using PHP and MySQL database. I'm customizing some calendar software, and I want the user to fill in a form by selecting a title from a drop-down list, generated by my MySQL database. However, the program I'm customizing uses arrays, which is where I'm stumped. What do I need to add to this code to make the array of titles(eg "report writing" etc) come from my database, rather than the manually-entered values that you can see here. The field I want to pull from is called com_courses.title array ( "coursetitle", "Course Title:", $EXTRA_SELECTLIST, array ("Report Writing", "Recruitment & Selection", "Presentation Skills", "Essential Telephone Skills", "Time Managememt", "Customer Care", "Other"), 0 ), I hope it's not cheeky to ask this, BTW I bought a book on Programming with PHP and MySQL, but it doesn't answer this question,
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that: - reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul> etc.? So basically it creates a list of links with the contents in that directory, so you can download them from there.
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not. What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings. SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100 What I'm getting, though is a list that looks like this: mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary. If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1. mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1 How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let users to reach out to all recipient on the list by simple send the email to a specific maillist- address. Mailman has this functionn but as a just got a webserver account I can't use mailman nor install it.
Select And Update Vs Update
For doing update or insert code, its worth noting that Example 1 seems to be around 60% faster than Example 2 PHP Code:
Checkbox
I am trying to make a form with 16 different checkboxes that pass on to an email. Someone got me started with the form but I'm not sure how to incorporate it into my php file. <INPUT name=other_needs[] type=checkbox id="other_needs[]" value=reception>Reception<TD> <TD><INPUT name=other_needs[] type=checkbox id="other_needs[]" value=Lunch>Lunch</TD> How do I refer to the checkboxes in my php file to include the results in the email the script sends?
Checkbox And SQL
What im stuck with at the moment is how to update the SQL database with the new information acquired from a set of check boxes. What i´ve done so far is to create the checkboxes and got the information from a table which checkboxes is needed and pre check it if it is already enabled. i have two rows in the database 1. Module_Name (name of a module) 2. is_enabled (is the module enabled 1 or 0). Code:
Checkbox Value
if i have 10 checkbox for customer interest.. how do i save that to database?? need to create 10 fields in the database?? after save.. how to display back when customer view his data.. if i choose swimming.. next time when i view back.. how to show swimming in the checkbox being checked
Checkbox
I have a database column which either holds the value 1 or 0. Now if there is a 1 in this column I want to produce a checkbox button that is ticked, and if a 0 then nothing ticked. So I thought it would work like this: <input name="dayTwo[]" type="text" id="dayTwo" value="<?php echo $databaseArray['d2']?>" size="6" /> However, it does not seem to work?
Checkbox
I am creating an email form with checkbox included. And I need the checkbox to be ticket when I enter the form though links. IE List of checkbox's checkbox 1 checkbox 2 checkbox 3 checkbox 4 say I was another page and I click on a link (call the link checkbox 1) I would like the checkbox to be ticked automatically. I know this makes no sense but I hope you get the idea.
Checkbox
i have a checkbox array of some unknown size.its a dynamic array created. i want to know out of all checkboxes how many r selected and which are they? and then insert the data in the table based on that. i hav written the code as follows:- <? $no=0; $friendname= $_POST['friendname']; $storecount=$_POST['storeid']; while($no<$storecount) { if($friendname[$no]) { $sql = "INSERT INTO groupfriends (groupid, username) VALUES ('$stid[$no]', '$friendname[$no]')"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); } $no=$no+1; } ?> i dont think this will work.it will add all the checkoxes data to the table. i want to insert only of those which r selected.
Checkbox Values
Basically, I have 2 checkbox's which are printed out for each record within my table. On the next form, each checkbox is tested for being "checked" and the database is updated accordingly. This is fine. My problem is that I dont want users to be able to select both check-box's at the same time. After talking to "andnaess" on an earlier post and doing some reading, I decided upon using some javascript to do what i wanted. I have found a script which does exactly what i want, and i am now incorporating it into my original php script. I am having problems assigning a name and value variable with an array to my checkbox's. Is this possible, or have i got the wrong idea?
Checkbox Confusion!!!!
I have page1.php that displays some articles from a database by the condition 'on' What I want to do is have checkboxes so that the articles you check won't be displayed on the web page the next time it's brought up. Essentially turn the articles checked to the 'off' condition and leave the articles that are not checked to the 'on' condition. When you hit the submit button I want it to go to a page2.php to run an update query to change the 'on' condition to the 'off' condition for the specific articles that were previously checked. (My Primary Key in the database is Article_Number) I think i have page1.php correct (don't quote me on this!) <input type='checkbox' name='Display_Article' value='off'>"; But I'm completely lost on what to do for the page2.php if($submit) { for ($i=0; $i<count($Display_Article); $i++) { //echo "<li>".$Display_Article[$i]."</li>"; $sql="Update articles set Display_Article='$Display_Article[$i]' where Article_Number='$Article_Number'"; $result=mysql_query($sql) or die ("Update Query Failed"); }
Checkbox Problem?
I am having trouble with checkboxes. How do you have a checkbox that it it is not checked it will still allow the form to be submitted. I am using checkboxes now, and if all the checkboxes are not checked, then it says that each of the ones that aren't checked are undefined variables why?
Problem With Checkbox
When i click on submit then the table wont be updated. I wanted to try to update the colom aw with the desired awardsid but i also wonder what happens if i have selected 2 or more checkboxes and whats entered then in the table aw, 1 & 2 or ? PHP Code:
Retain Checkbox Value
Just a quick question regarding the way to do something rather than the actual code :- I have a page which has some links that go through to a HTML form and each link will check a certain checkbox. I want the form to retain the checked status of any checkboxes that are set to checked when the user goes back to the previous page. Would this be best done using sessions or is there another way I could use? I don't mind using sessions as I have used them before. I would like to avoid using cookies but I don't really have any strong objections to using them, it's just that they're not 100% reliable (but then, what is?).
CheckBox Question
i started a php site in dreamweaver and i try fill data into MySql database. i set up a page with a form and i can fill in all the fields. just for one field, i like to have several checkboxes. every checkbox has a value, and they should fill the same field with their vale when checked. i also want to keep my text box, so i can write additional information. at the moment, when i click more than one checkbox, only the value of the first checkbox appears in the database. also, if there is already some data in this cell, it delete previous data, but i would like to keep it. preferably it should just add to information allready in the database.
Disable Checkbox
I have a checkbox that I set by php code to be either "checked" or "". I want to disable the ability of the user to check or uncheck it. I tried "readonly", but that didn't work.
Checkbox Problem !
I try to display the multiple checkbox in my form and the quantity of this are depends on how many records in my database (usually the record is more than 500). So how big space it takes to display. And to solve the spaces problem, i thing i better display with horizontal scrollbar to save the space. But i don't know to do it.
Checking A Checkbox
Is it possible to preset the values of form elements with php - so that when the client gets the page certain boxes are checked or completed - on the fly - based on their HTML id. Javascript has a way of doing this - but i need the functionality of PHP too - so if i can move the whole thing over to php it owuld be better . javascript example - document.forms['form1'].elements['radiobuttonno'].checked = true;
Checkbox Array
checkbox arrays do not hold their respective positions as do other field arrays that are established to store the contents of selected records. The problem is that when you "uncheck" one of the elements and then repost, that array element disappears and the whole array collapses and renumbers itself with only the remaining "checked" ones -- simply useless when dealing with records in a table where all the field array elements should be in sync. I consider it a bug -- why does the array have to collapse? Why can't it just hold a null value and keep its position? The only fix is to never hold checkbox values in an array. Store them in individual variables numbered like an array, then do an "eval" to retrieve the contents. Here's the whole thing in action: Code:
Checkbox Not Between Date
I get a database for « News » on Internet. Side Admin, I would like a form to know witch "News" are Online or not. In my database mysql I get : Date_start and Date_end Outside this date, the « News » are unvisible. In my form I put a checkbox « Off_line » If it's check, all the news outside Date_start And Date_end must be visible. I tryed like this In Head : <?php if (isset($HTTP_GET_VARS["date_off"])) { $ date_off =$HTTP_GET_VARS["date_off"]; } else { $ date_off =0; } ?> In my form for checkbox : <input <?php if ("CURRENT_DATE NOT BETWEEN $row_R_news['date_start'] AND $row_R_news['date_end'] ",1) {echo "checked="checked"";} ?> name=" date_off " type="checkbox" id=" date_off " value="1"> For my request sql : SELECT t_news.* FROM t_news WHERE $date_off
Checkbox Array
I have a list of checkboxes. The name for each is being pulled up from a database. Each (minus irrelevent or implicit code) looks like this ... <input type=checkbox name=assnid$assnarray[assnid] value=1> or...peaking at the HTML, the list looks like this: <input type=checkbox name=assnid1 value=1> <input type=checkbox name=assnid2 value=1> <input type=checkbox name=assnid3 value=1> and so on... Anybody know how to post the selected checkboxes into $assnidarray? For example, assuming all are chosen, $assnidarray would be (1,2,3,...).
Checkbox Array
I have a checkbox array containing the id of a record in a MySQL database. The checkboxes are created dynamically depending on what is stored in the database. I want to send the checkbox array to my stop_subscriptions.php file, running the code on all checked boxes, however I dont seem to be able to actually send the array, I was hoping that someone could steer me in the right direction. <?php $sql = "SELECT i.type, i.title , s.inj_id FROM inj_subscription s, injustices i WHERE s.member_id = '$user' AND i.inj_id = s.inj_id AND s.inj_id IS NOT null" ; $result = mysql_query($sql); $row = mysql_fetch_assoc($result) ; if ($row) { echo "<div><span>Specific Subsriptions:</span><br/>" ; $table_start ='<table width="90%" table name="table2" align="center" cellspacing="0" border="0"> <tr> <form method="post" action="stop_subscription.php"> <th width="20%">Type</th> <th width="70%">Title</th> <th width="10%"></th> <input type="submit" name="Submit" value="Submit" style="font-size:10px"/><p> <input type="hidden" name="stop_subscription" value="1"/> </form> </tr>' echo $table_start; $rownum = 0; while($row) { $rownum++; $style = rowcolor($rownum); $table_rows .= '<td id="td" align="center" style="'.$style.'padding:5px;" >'." ".'<form><input type="checkbox" name="deletethis[]" value="'.$row['inj_id'] . '"></form></td>'." "; echo "<tr>" . $table_rows . "</tr>"; $row = mysql_fetch_assoc($result) ; } echo '</table><Br/></div><br/>' } ?>
|