Taking Multiple Values From Checkboxes And Passing Them To The Header On "submit"

Feb 19, 2011

This is probably very easy but im also very new to php. Im looking for a way that i can have checkboxes on a form that can be passed via the submit button to a php file that generates a Header locate based on the values. for example

Apples X
Oranges X

would result in the output php file doing a header("Location:url.com/Apples+Oranges");

Im haivng difficulty working out how to get the checkbox values as a string and secondly in doing this above the header causes the header to fail for obvious reasons so I guess i have to use some output buffer?


Passing The Values Of Checkboxes To An Array?

Jun 9, 2011

I am passing the values of my checkboxes to an array. I then want to put the array in to a foreach loop and then take the id number and removes the records from the database using the foreach loop

However after the passing the values from the checkboxes to the array, it just prints array and goes not further.

Here is my code beloe

PHP Code:

$id_number = array($_POST['multi_delete']);
foreach ( $id_number AS $a )
// Do database delete using id from array


View 2 Replies View Related

Selecting Multiple Values From Multiple Tables Using Checkboxes

Sep 10, 2007

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:

View 2 Replies View Related

Multiple Checkboxes - How To Insert The Values Into The DB

Feb 20, 2007

I have a sql sb and in one of the tables it is a field called group. This field contains some numbers, etc "2 5 4" In a form i have som checkboxes Code:

[ ] Some text (value 1)
[x] Some text (value 2)
[ ] Some text (value 3)
[X] Some text (value 4)
[X] Some text (value 5)

I want these checkboxes to be checked accordingly to the field in the db. In this case with my example above the second, fourth and fifth checkbox is selected. Also on how to insert the values into the DB. This is probably very simple, but I have a bad day, and i can't figure this out.

View 6 Replies View Related

Inserting Multiple Values In Db Row Using Checkboxes.

Jun 16, 2004

I am trying to insert multiple text values into a database row using checkboxes. This is what I have. Checkboxes for each class:


Person checks all that apply and I would like the values of all inserted into a row in the db. Code:

View 1 Replies View Related

Retrieving Multiple Values In Checkboxes?

Nov 29, 2009

what i wanted to do is to retrieved all the values in table per row. how do i do this?

heres my code:

echo "<td><input type='checkbox' name='enrolldis[][][]' value=''></td>";
echo "<td>$secname</td><td>$subjcode</td><td>$subjname</td><td>$schoolyear</td><td>$room</td><td>$days</td><td>$sectime</td><td>$slotavailable</td><td>$unitload</td>";echo "</tr>";

how do i put values in arrays of checkboxes?

View 5 Replies View Related

Multiple Checkboxes Values To URL String?

Feb 25, 2010

Working backwards (as I usually do) my 'results' page currently functions by getting values from the URL

E.g. tagged.php?tags[]=pink&tags[]=snow

How can I make a form with checkboxes for each value generate a URL like this?

Or is there a better way of passing the values from form to result?

View 6 Replies View Related

Multiple Values To One Field Using Checkboxes?

Jul 13, 2009

I'm trying to code an interface through which my administrative manager can keep track of the forms we've received in from my students, among other things. This information in turn would be displayed to parents/students when they log in. I'm having trouble storing multiple values to one field in my MySQL database. Right now the form looks like this:

Last Name: (input)
First Name: (input)
Role: (input)

View 4 Replies View Related

Add Values Of Multiple Selected Checkboxes With Comma?

Apr 10, 2010

i want to insert all selected checkboxes values with a comma separator in database in one single column.

i m able to echo all the checkboxes selected through the below code

<input  type="checkbox" value="Battery"  name="checkbox[]" id="checkbox[]" />   
for ($i=0; $i<count($_REQUEST['checkbox']);$i++) {
echo "chosen<br />$i. ".$_REQUEST['checkbox'][$i];

ouput is

0. battery
1. rocket
2. pineapple  

i want to insert all selected checkboxes values with a comma separator in database in one single column.

so what should i write in my query

$query = "insert into checkbox table (checkboxes) values()"  

View 3 Replies View Related

Send Multiple Checkboxes Values Using Scriptaculous

May 15, 2011

I have some checkbox array like these code. What I am trying to do is to send the values of all the checked checkboxes to reload.php on click. It doesn't work and I can not find useful things in google. Does anyone have any ideas how I can do this?


View 1 Replies View Related

Foreach Error - Multiple Checkboxes Values Into An Array

Dec 20, 2006

I have a table where multiple checkboxes are ticked and values put into an array. These values echo ok but when i use the foreach part of the script, it doesnt get processed. Could someone please have a look at the script and see what mistake i am making ? Code:

View 3 Replies View Related

MySQL Insert Values From Multiple Checkboxes Into One Column In Table

Jun 1, 2011

I have a form that a user would fill out while creating a ticket for a bug they have found on our website. In the form there is currently an input field where the user would enter in the designs that the bug is affecting (ex., "Design1, Design2, Design3, Design4" ...etc). When the form is submitted the value is stored in a table column named affectedDesigns. What i am wanting to do is create several checkboxes (one check box for each design we have) that a user would select instead of using the input field. They would be able to select all that apply.

If possible i would still like to store all of the values into the affectedDesigns column in one record. I'm thinking that i can gather the selected checkboxes values and create an array or some comma delimited value that contains all of the selected items and submit that to the databasein the one record in the affectedDesigns column. How can i achieve this? Also, how would i then pull that data and re-populate the checkboxes if they would like to go back later and edit the ticket?

View 6 Replies View Related

Dynamically Create - Store And Retrieve Values From Multiple Checkboxes

May 20, 2011

i am using a MySql database and i need to create a dynamic HTML table with one of its columns as checkboxes.so i have to create multiple checkboxes.but these checkbox values are to be stored in a mysql table and then later retrieved when form reloads.and depending on previous state when form was submitted, the newly created checkboxes have to be checked in the same manner.so how do i store multiple checkbox values in my table and also how do i retrieve them?

View 5 Replies View Related

Passing Multiple Selected Checkboxes From Form To SQL "search Engine"?

May 16, 2011

I've built a press cuttings database which allows users to categorise press cuttings with various select-one-option attributes (i.e. journalist, publication etc.) and also tag them with multiple communication theme tags (mentions sponsor, mentions CEO, review, good quotes etc.) (many to many relationship).

I've got the add new cutting/edit existing cutting front-end forms all under control, and the search functionality is all working perfectly, apart from the tags. If you select multiple checkboxes for multiple tags in the search form (e.g. tags=2 and tags=3), it only searches on the last one selected (e.g. tags=3) and ignores cuttings with which are tagged with tags=2.

I'm still a bit of a newbie to all this - however, my limited knowledge is telling me that even though I can see both tag values are being sent through the $_GET form (since I can see them both in the URL) the first value assigned to the variable (tags=2) is being overwritten by the second value (tags=3) therefore it only searches on the second value. Therefore I think that means I need to do one of two things: (1) turn the selected checkboxes being submitted into an array, but I'm not sure whether it is best to do that at the form end or at the back end. or (2) alter the SQL somehow to select cuttings based on an 'equal-to-any-of-the-following' list of values returned..I've stripped back a lot of the code/database so it just shows the stuff relevant to what I'm talking about.

Here's the SQL for a stripped back version of the database:

SQL Code:
USE press;
CREATE TABLE cutting (
cutting_text TEXT


View 14 Replies View Related

Get Values From Multiple Forms And Submit Them?

Oct 22, 2009

I have several forms inside DIVS on my page.

I have one form which contains a text field and is always visible, and this is where the user hits 'enter' key and submits...

I want to get values selected in the other forms on the page, and submit them all together, not one by one, so that my PHP code can use "ALL VALUES" and search a mysql database...

Is this possible by javascript using the "<form onsubmit>" to call a javascript?

View 4 Replies View Related

Submit Multiple Form Values At Once?

Feb 14, 2010

I have a form as follows

echo  '<form action = "test.php" method="pos">';
echo 'name:<input name ="id" type="text">';
echo '<input name="Submit1" type="submit" value ="submit"/>';
$name = $_POST["id"];
// then do some table insert

How would I do multiple values at once.  Can I use an array somehow and then use a foreach to loop through?

View 3 Replies View Related

Use Array To Submit Multiple Values In Form - Getting Values Inserted And The "hashing" Of The Passwords?

Jan 28, 2011

i am working on a project to capture students' data for an educational institution. I want to have a form that allows multiple student records to be filled in at once..e.g(this is the form):


for the code to insert it into the database..this is what i came up with:

include 'poly_connect.php'; 
foreach ($_POST['reg_no'] as $row=>$reg_no)


...problem is its not inserting anything..i need help on getting these values inserted and also the "hashing" of the passwords.

View 4 Replies View Related

Passing Multiple Table Values

Aug 12, 2007

I have a products table that I have created from a query, but I need to update the information based on quatity. What I am confused about is how to pass the multiple values to another page when they have the same variable names. Code:

View 1 Replies View Related

Passing Multiple Values Through Query String?

May 14, 2011

How to pass multiple values through query string in php. i want to pass values to more than one page...

View 5 Replies View Related

Multiple Form Values In One Field To Submit To Scripts?

Sep 11, 2006

I need to have a form field that holds two values instead of one to get the following accomplished:

Let's say I'm selling blue, red, and green widgets. I have a radio button that chooses which one you want to purchase. What I need to happen, is when the form posts to a PHP script, is to have a variable available for both the name of the product chosen, as well as the price of that product. Code:

View 1 Replies View Related

Send Multiple Values With An Input Type=submit Form?

Mar 24, 2011

Some background: I'm working on a member directory page which displays member information gathered from a MySqL database. I have a loop set to display name, id#, title, etc from each member - one member per row. The displayed member list can be searched and sorted so will be anywhere from 0-20 entries long (20 max per page).Each member's name can be clicked and more information pertaining to them is displayed. For example, if the user clicks on "John Doe"'s name, an "individual info" page for John is included, splitting the list of names (the info is included directly after his name's listing, but before the next member's listing - ["John Doe, #333" / "Jane, #777"] turns into "John Doe, #333 / {John is a graduate from...}" / "Jane, #777"])I currently populate my page with PHP so the list is inside of a form and their names are displayed as inputs so when the user clicks them, the form action ($self) is run. I have the form value set to the member's name so that users can see readable names. I have the input's name set to the member's id# and run a if(isset($_POST['userID']) inside my loop to determine which member's individual information is displayed. So, the loop runs through the MySQL query, displaying name,id... for each member and if curID# == $_POST['userID'], it also displays the corresponding individual information.My Issue: The problem I'm encountering is that my list is rather long on the page, especially with individual information displayed so I want to be able to jump to the member's info on the page using anchors corresponding to their ID#. I have the anchors set up, I can manually navigate to memList.php#ID333, but I want to navigate there when the user clicks on the name.I can set up my form action to navigate to $self#$curID, but $curID is the variable name for the member's name input, not the value of it.What Hasn't Worked: I've attempted hidden fields with their ID as the value and curiD as the name, but they do not work because my loop resets it for every member (hence, $_POsT['curid'] is always set to the bottom-most member, not the one the user clicked).I've had the names as href links, but then my search and sort $POST values are not resent (the page is basically refreshed from the start).

View 1 Replies View Related

Jquery - Grab Multiple Input Radio Values And Submit To Script?

May 12, 2011

I want to learn how to grab multiple input type button value compare to original value and last submit to php script! How can I do that with Jquery?

<div id="leftDiv" class="container">
<form action="" method="get">

View 2 Replies View Related

Passing Radio Button Values To A Submit Button (gif)

May 24, 2007

How do i pass the value of the radio button to be put of the action
that includes the value as part of the URL being submitted - "/
picked.php?pick_num=". Any help with be appreciated. Thanks

<form method="post" action="/picked.php?pick_num=".<php? $value ?
<input type="hidden" name="cmd" value="0">

<table width="100%">
<td align="center">
<INPUT TYPE='RADIO' NAME='pick_1' VALUE=&#391;'>Day;
<INPUT TYPE='RADIO' NAME='pick_2' VALUE=&#392;'>Week;
<td align="center"><input type="img src="/images/pick_now.gif"
BORDER="0" name="send"></td>

View 2 Replies View Related

Taking Values From URL?

Apr 26, 2010

I have managed to get a variable into the URL: .nts.php?table=tester1 But how do I get the value of table out of it?

View 6 Replies View Related

Header Function Redirect Argument Passing / Error Header('Location: ReservationConfirmation.php?confirmationNum='?

Mar 26, 2011

I want to redirect to some other page and pass multiple argument from header in PHP.I can pass one argument,but when i start adding more parameters it gives error.I think most probably there is something syntax error.But i can't get around it.

This is when i have one argument it works fine.

header('Location: ReservationConfirmation.php?confirmationNum=' . mysql_insert_id());

I want to add additional parameters here,but it gives error.

header('Location: ReservationConfirmation.php?confirmationNum='. mysql_insert_id()'&dtTimeSlot='$dtTimeSlot'&iTheatreId='$iTheatreId);

View 1 Replies View Related

$_SESSION Array Not Taking It's Values

Jun 23, 2005

if (isset($_POST['scheck'])) {
foreach ($_POST as $key => $val) {
$_SESSION['$key'] = $val; ...?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

here is the session data but everytime I check the session values the array allways stays empty.

View 1 Replies View Related

Merge Two Arrays By Taking Over Only Values From The Second Array That Has The Same Keys As The First One?

Jul 3, 2011

I'd like to merge two arrays with each other:

$filtered = array(1 => 'a', 3 => 'c');
$changed = array(2 => 'b*', 3 => 'c*');

Whereas the merge should include all elements of $filtered and all those elements of $changed that have a corresponding key in $filtered:

$merged = array(1 => 'a', 3 => 'c*');

array_merge($filtered, $changed) would add the additional keys of $changed into $filtered as well. So it does not really fit.I know that I can use $keys = array_intersect_key($filtered, $changed) to get the keys that exist in both arrays which is already half of the work.

However I'm wondering if there is any (native) function that can reduce the $changed array into an array with the $keys specified by array_intersect_key? I know I can use array_filter with a callback function and check against $keys therein, but there is probably some other purely native function to extract only those elements from an array of which the keys can be specified?I'm asking because the native functions are often much faster than array_filter with a callback.

View 1 Replies View Related

Submit Checkboxes Through A Form?

May 31, 2010

I'm trying to submit checkboxes through a form, but it doesn't seem to be working like "text" type inputs.Here's the Xhtml:

Code: [Select]<label for="veggies">Vegetables
<input type="checkbox" name="testbox [veg]" id="veggies" value="veggies" />

View 10 Replies View Related

Passing Array Using Checkboxes

Feb 8, 2007

As you know, when we name checkboxes as name[], PHP thinks the values are forming an array.

<input type="checkbox" name="fruits[]" value="Apple" checked>
<input type="checkbox" name="fruits[]" value="Orange" checked>
<input type="checkbox" name="fruits[]" value="Kiwi" checked>

Is this only valid with checkboxes? Why can't we do the same with text boxes?

<input type="text" name="fruits[]" value="Apple" readonly>
<input type="text" name="fruits[]" value="Orange" readonly>
<input type="text" name="fruits[]" value="Kiwi" readonly>

View 3 Replies View Related

Checkboxes Retaining Value After Submit Is Pressed?

Nov 20, 2009

I am working with a DB and a php form, where the user can make selections and it filters down the original total, based upon their selection. They hit the submit button, and it shows them how many results (on the same page). I've got all this working, but I cannot for the life of me figure out to retain the checkbox as checked (if they checked it) after they hit submit! I need to write to get it to show the checks the user checked after they hit submit.

Also, I found a way to use php to get the box to remember, but it's based on the name of the checkbox, not the value. Obviously, the names are the same (in this case "enrollment[]"... but I don't know how to attach the value as the thing that is the great signifier. I've scoured the internet and wracked my brain for three days..Here is the code for one of the tables.


PHP Code:

View 1 Replies View Related

Grab Data From Multiple Checkboxes And Multiple Dropdowns?

Dec 12, 2010

i want to grab an id from the checkbox then grab the option drop down associated with that check box and update a mysql row here is my code so far

mysql_connect("localhost", "root", "root") or die(mysql_error());
mysql_select_db("db1") or die(mysql_error());
$query = "SELECT * FROM tickets ORDER BY id DESC";
$result = mysql_query($query) or die(mysql_error());


View 3 Replies View Related

Taking Multiple Results From A Mysql Query And Storing Them In Variables?

Oct 20, 2009

I'm trying to pull data from my mysql query, which I know how to do, but I'm finding it a hard to specifify which data I'd like to show, to give you an example, my query and display results are below

Code: [Select]$query_customfield = mysql_query("SELECT  * FROM `swusers` LEFT JOIN `swcustomfieldvalues` ON swusers.userid = swcustomfieldvalues.typeid") or die(mysql_error());
while($info = mysql_fetch_array($query_customfield))
$aonumber = $info['customfieldid'];
$aoname = $info['fullname'];


The main question here is how can I make the following a variable using 51 as the sample value of customfieldid

Code: [Select]$_POST['customfieldid'] == '51'

View 2 Replies View Related

Passing Checkboxes Data Into Database

Oct 20, 2005

anyone noes how to pass a group of checkboxes data into the database?

View 4 Replies View Related

Checkboxes Don't Submit If Unchecked, So How Can I Default Them To True?

Sep 8, 2010

I have a form with a checkbox that's used to filter some search results.The form action is GET so that the users can navigate back to the search results without having to OK the post data request message.I want one of the checkboxes to default to true. This in itself is not a problem of course, it's simple HTML. However, it's the PHP that powers it that I'm struggling to figure out.When the user visits the page for the first time, there won't be any GET variables set, meaning thisCheckbox would be unset and all the relevant checks would evaluate to false. Meaning I can't do:

#this returns a false negative
if (isset($_GET['thisCheckbox'])) echo 'checked="checked"';

If the user explicity ticks the checkbox and submits, then it's fine, because $_GET['thisCheckbox'] will be true.
Is there a way of getting round this (without using radio buttons)?

View 5 Replies View Related

Retrieve Individual Header Field Values After Retrieving The Header String With CURL?

Apr 7, 2011

I am using CURL to execute HTTP requests. I get back something like this:

HTTP/1.1 200 OK
Date: Thu, 07 Apr 2011 15:52:33 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1

My question is, how can I reliably retrieve any of the four named fields' values?

Right now I am doing this:

$name = 'Expires';
preg_match('/^'.$name.': ([^
]*$/m', $headers, $matches);

It seems to be working. I'm just curious of my regular expression here is going to work for every well-formed header I ever receive from a server, or if there are variances where it would break. I can't seem to find specific restrictions on valid characters, newlines or carriage returns so I don't know if all values will follow the format:

Fieldname followed by colon, followed by space, followed by non-newline characters, followed by newline characters.

View 3 Replies View Related

Submit Multiple Form On Single Submit Button With Different Actions?

Apr 14, 2010

I am trying to login for website with autologin to forum,and vcalender

its work fine in mozilla and ie but it gives problem in safari(IN MAC)

following is the code
//echo "<pre/>";


View 4 Replies View Related

Syntax For Passing Array Data From Checkboxes In A Form

Nov 18, 2002

If I have a list of checkboxes saved in an array,when I submit (POST) the form data, do I need to use $HTTP_POST_VARS in the target document, or can I just use the following code:

for ($i = 0; $i < count($selectedmessages); $i++){
$checkbox_value = "$selectedmessages[$i]";}

If I need to use $HTTP_POST_VARS, what would the syntax be if my array is called selectedmessages[]?

View 4 Replies View Related

Jquery, Checkboxes Within Nested Div Onclick Show/hide Submit

Jan 31, 2011

I have a page that has a series of div's in a shopping-cart system. Each is a product, when checking the checkbox, if there are options available and/or an acknowledge checkbox to be acknowledged before form submit, then keep the button hidden and show a div with another checkbox in it, when that checkbox if exists is checked then show button.
The show hide on each div is working properly (existing code), So I am trying to create a function to be called within that function for the onclick event.

where my issue arises is the check to see if another check box [shown in the example as(tmpId == "acknowledge")] does exist and that it is checked also before they can see the submit button, if not show the submit button. This would need to work for each product they click the first checkbox on [ie("id= "+feeSID+"_checkbox")]... $("#ocContainer") is the hidden container(with submit) to show if proper checkboxes are checked.. for each product selected.

the first part of each id is a variable generated by a sql query and passed to the function..
My Function:

var feeSID = "";
var feeVAL = "";
var pop = "";

function countChecked(feeSID) {
var n = $("input:checked").val();
var tmpId = $(this).attr("name");
if (tmpId == "acknowledge") {
console.log("acknowledge Clicked <br />");
} else {
feeVAL = $(this).attr("id");
if (feeVAL == '') {
} else {
if ($("#" + feeSID + "_checkbox:checked")) {
console.log("id= " + feeSID + "_checkbox");
var pop = $("#" + feeSID + "_popup").length;
if (pop > 0) {
$(":checkbox").click(function () {
if (tmpId == "acknowledge") {
} else {

I hope my explanation was clear. I am getting an error of:
uncaught exception: Syntax error, unrecognized expression: #[object Object]_popup

View 2 Replies View Related

Remove Submit.x And Submit.y But Retain Other Values In URL?

Aug 7, 2009

With my PHP form, I want to pass one value to the URL, but remove submit.x and submit.y. Here's my form:

<form action="booking.php" method="get">
<input type="image" value="access" class="rollbtn" src="../images/book-btn.gif" alt="Book" name="submit" />

I want the URL to display booking.php?submit=access - but omit the x and y coordinates that result from the type="image". If I add onsubmit="this.submit();return false;" it strips everything. Is there a way to do this, or should I just use type="submit" and style the button?

View 3 Replies View Related

Get Values From Checkboxes

Mar 10, 2006

I have 20 checkboxes called myfield..(do i have to call myfield[]?) now in the post of this how can I pull up all the checked values in a string (separated by commas) What I really want to do is let teh user choose which fields should be queried and then build the sql with those fields. I have all this code in asp and i'm trying to workout how to tranlsate to php.

View 3 Replies View Related

Submit Two Values With Only One Submit Button?

May 20, 2011

im making a website were you can send other users emails. My problem is when I go and submit it doesn't submit both values? my Form has a text box where the user wants to send the email and another is a text area which is the message. and i don't want 2 submit buttons

View 4 Replies View Related

Pass One Of The Values From The Checkboxes?

May 10, 2010

How to do normal input fields and radio buttons, but not checkboxes.can get it to pass one of the values from the checkboxes, but once select more than one it does not work.The actual form(request.php).

PHP Code:<form method="POST" action="cforms/mark_p.php">...<br>
<input type="checkbox" name="checkboxone[]" value="completeset">
<input type="checkbox" name="checkboxone[]" value="companyintro">


View 3 Replies View Related

Multiple Checkboxes

Sep 26, 2005

I have a php form where the results are being emailed. My problem is that when users select multiple checkboxes, only the first selection shows up in the email. How should the code read so that EVERY checkbox selection that a user makes shows up in the email. Currently my code reads like this:

Times Available: $availability

View 5 Replies View Related

Passing Values Directly To A New Page And Using Them To Update Values

Aug 30, 2006

I'm trying to pass values through from one page to the next by clicking on an image. When I click an image it passes through the values for prodId and shopName

This is passed through to my admin_update.php where I want to populate a table with all of the details stored on the product that was clicked on. The values are being passed through ok but the table is not being displayed.

I have another update page but with this page i am using a submit button which is passing through the details. I tried using this method again but because there is no submit button used (I am just clicking on a link/image) it is not working for me. Code:

View 8 Replies View Related

Validate Checkboxes Then Insert Values Into DB

Dec 7, 2004

I have a group of checkboxes:

<input type="checkbox" name="programs" value="1">
<input type="checkbox" name="programs" value="2">
<input type="checkbox" name="programs" value="3">
<input type="checkbox" name="programs" value="4">
<input type="checkbox" name="programs" value="5">

the user has to check at least one box before submitting the form. so i used some javascript to do the validation.

<script language="JavaScript">
function validateForm()

//----------- check check boxes
// set var checkbox_choice to false
var checkbox_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < myForm.programs.length; counter++)
// If a radio button has been selected it will return true
// (If not it will return false)
if (myForm.programs[counter].checked)
checkbox_choice = true;

if (!checkbox_choice)
// If there were no selections made display an alert box
alert("Please select the program(s) you have watched.")
return (false);

the validation works fine. but then i am having trouble capturing which checkboxes the user checked and insert that information into the DB.

I understand that a way to capture which checkboxes the user checked is to name the checkbox name like "programs[]" so that php knows to treat it like an array. I tried doing that but my javascript validation function didn't work if i use "programs[]" instead of "programs".

View 1 Replies View Related