Submitting Multiple Form Fields In An Array / Loop

Jul 17, 2005

I have the following form

<?php do { ?>
<input name="approve[]" type="checkbox" id="approve[]" value="<?php echo
$row_rs['ID']; ?>">
<select name="select">
<option value="1">option 1</option>
<option value="2">option 2</option>
<option value="3">option 3</option>

<?php } while ($row_rs = mysql_fetch_assoc($rs)); ?>

I want to acheive a loop that inserts a record into a database that enters
the id and the value they have selected (if the approve input box was

so far I have this:
foreach($approve as $aID) {
$insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES



How do I enter the select value within this loop?
I assumed that it would be just
$insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES

View 3 Replies


Submitting Form Multiple Times In .each() Loop - Only Last Submit Sending

I am trying to submit a form then update some values and submit it again. However, when I do this only the LAST version is being submitted. I get one error for Unsafe Javascript attempt to access frame with URL from frame with URL domain1 . Domains, Protocols and Ports must match.

form code:

<form id="hiddenform" method="post" enctype="multipart/form-data" action="" accept-charset="UTF-8" target="tintest">

the target is a hidden iframe with the id="tintest"

This is my code:

var tbody = $("#vmMainPage table:first tbody");
var lng = tbody[0].rows.length - 1;
var mnstr = "items: ";
$("#vmMainPage table:first tbody tr").each(function(i){


View 1 Replies

Get Fields Value Without Submitting Form?

Is there in PHP something similar to javascript's getElementById('').... I'd like to get the value of an input field without submitting a form...

View 1 Replies

Submitting Only A Particulate Field When There Are Many Fields In A Form

I have a webpage in php which contains many fiields.But when i enter data into one particular field(say the first field),i need the form to get submitted and do certain task.

View 5 Replies

Validate Form Before Submitting (more Complicated Than Checking For Empty Fields)

i have a form containing inputs for times (specifically, an opening and closing time). when the submit button is pressed, it goes to a php page where these inputs are added to a database. i want to check a few things before allowing the form to submit. for example, i want to make sure that the start time is earlier than (less than) the end time. here's the form:

<select name="starthour1">
<option value="00">12</option>
<option value="01">1</option>
<option value="02">2</option>


however, checking this stuff after submitting doesn't make sense. i suppose i could redirect back to the initial page if the error was found, but that doesn't seem efficient.

also, i was thinking maybe i could have some php on the page with the form that checks for validity. if it validates, it then posts to the php page that inserts stuff into the database. does this make sense and is it possible?

is there a better solution? i imagine there is something i could do with javascript but i haven't been able to figure it out.

additionally i'd like to inform the user of invalid inputs with text that appears next to the input box. i should be able to figure this out once the rest is working though.

View 4 Replies

Submitting Multiple Rows With One Form.

I am trying to create a form for my users to submit multiple rows to a databse, I have a few questions.

1. I would like the form to have an option before they start filling out the form, the option should be how many kinds of pop they would like to submit with options 1-5.

2. I would like the information that they submit to be submitted to the database but, I would like it to be in different rows. eg 5 kinds of pop 5 rows.

View 1 Replies

Submitting (Editing) Multiple Rows In A Form

i am having a problem related to form submission(not a simple form submission)
b4 reading plz open this URL to have an idea of what i am talking about Code:

View 1 Replies

Multiple Of Values In Third Textbox Without Submitting Form?

want to made a form in which there is three fields.1.product value suppose 1500.2.number of product:2.3.then want to show multiple of these values in third textbox without submitting form.

View 3 Replies

Form Submitting Multiple Files Not Retaining Data?

Ok so i have a html form, 10 files get uploaded. 6 images and 4 pdf. some of theses files are required others not.

My problem is when my script verifys the data and retuns to the user that he/she has errors all the file inputs are come back as blank... and if the user re-submitts... the files are not saved.

This form has other fields other than the files as well.

I tried putting $_POST in the value of my inputs but that does not repopulate with the local file names.

I would like it so my users dont need to re enter all the files they want to upload if they made 1 or a few mistakes.

SO is this normal that the post isnt giving me the file name? is the file still saved as temp on the server?

View 3 Replies

Html - Prevent Multiple Inserts When Submitting A Form?

Sometimes the user may press Enter twice, and the post is inserted twice.

Is there a solution to prevent this other than check if there is already a post with the same title and content?

View 12 Replies

Submitting Multiple Select Form Values To Salesforce?

I have a contact form on my site that has 1 multiple select field. Since I'm using this form to also store the values to a DB I'm also sending the data to Salesforce CRM through CURL.It's something like this:HTML Code:

<label for="interested_in"> Interested in Service <span class="req">*</span></label>
<select id="interested_in" class="selectfield" multiple="multiple" name="interested_in" title="Service Interest">


View 5 Replies

Submitting Multiple Rows To Database With One Form In Codeigniter

I'm trying to create a bulk edit page for an app that I'm working on. The table contains rows of products each of which have three editable fields.

<input type="hidden" name="id" value="10">
<td>Product Name</td>
<select name="product_category" value="" tabindex="4">
<option value="1">Category 1</option>

Every row can be edited and there is one submit button on the page. How should I format this correctly so that I can update each entry in the database with the values?

View 1 Replies

Loop Through Multiple Text Fields Labeled 'number'?

Loop through form input text fields.Loop through multiple text fields labeled 'number' and it's only submitting the very last number field instead of all 'number' fields.

Code:for ($i = 0; $i < count($_POST['number']); $i++) {
$sql='INSERT INTO orders (custNum,contractNum,equipId,prodNum)
. "'" . mysql_real_escape_string($_SESSION['custNum']) . "', "


View 1 Replies

Submitting Multiple Form Data Inputs On Single Submit Button?

Here's the code that I'm working on

<div class="Normal_P">
<span class="Normal_C">
<form action="<?php getLink("" array(


Now, I have it so that the user can choose to have up to 5 certificates, and I need a submit button that will send each certificate with only the selected option from the select input.

View 3 Replies

Loop Form Fields In Counter?

I have 1 form and in that form I loop through my database of people and display form fields such as first name, last name, age, nationality etc and each form field is displayed as such:

PHP Code:

// while loop here for each db record
<input type="text" name=firstname[$personid] />
<input type="text" name=lastnamename[$personid] />
<select name=nationality[$personid]></select>
// close while loop


View 2 Replies

Loop Form Validation With Non Required Fields

Basically I am looking to validate a form with non-required fields. If the fields are required and dont pass validation, I want it to list those fields. If the fields aren't required, just to skip the field and go to the next. Here is what I have so far, and I'm just looking for generalization, not actual code. Form submitted via post post variables are cleaned and assigned to associative array via foreach and varaible variables:


Now, I want to loop through ad_info and validate the fields that are required. Some fields aren't required. How would I skip those for validation? Do I split the array somehow and then merge it after validation? Do I put the non-required fields in an array and 'continue' past them in a loop? I'm trying to make this as dynamic as I can. My eventual goal is to put the values in the array into the database.

View 4 Replies

Dynamic Form Fields/multiple Page Form?

It is for a friends out of print booksite, where visitors can request multiple books to be searched by adding one at a time to a cart (javascript), then once all added they submit to another form where they enter their personal details and all is sent through. The problem is at the moment they cannot change whats in the cart without refreshing the browser window and losing everything.

1) present for asking how many books they want to search for
2) display multiple rows of the same input fields depending on how many books they say they want to have searched for?i.e


3) when these are submitted they could see these above the next part of the form where they enter their details with the option to go back and delete/amend.
4) send all the info to my colleague.

if so has anyone seen a similar script that I could take a look @ to see if I can hack it to suit my needs?

View 2 Replies

Multiple Form Fields

I have multiple textfields. Code:

<input type="text" name="date1" id="date1" value="" />
<input type="text" name="date2" id="date2" value="" />

I want to insert each field into one database table column(date).

View 9 Replies

Sticky Form With Multiple Fields

how do i create a sticky form with multiple fields? say
i want a form with:

name: [input field name]
address: [input field address]
country: [input field country]

[submit button]

and if a user presses the submit button it will show
exactly the same page with the fields that the user
has entered filled in with the values (s)he entered
(validation of the values will come later), and the
info of the form sent.

should i name all the values in the form separately
or should i use an array?

View 2 Replies

HTML Form Multiple Fields?

I have html form that looks like:

<form method="post" action="?a=up">
...some mysql query...
while ($i = mysql_fetch_array($result)) {
<input name="name[]" type="text" value="<?=$i['name'];?>" />
<input name="years[]" type="text" value="<?=abs($age);?>"/>
<input name="to[]" type="checkbox" value="<?=$i['id'];?>" />


View 3 Replies

Processing Multiple Form Fields?

Is there a better way to process a form where I need to save a link and link text against a language and company? The example below works, but I think it is hard work. I have added the language and company id to the key of the link and link text fields as a way of grouping them together and passing the other information through to PHP and into the DB.

$newlinks = array();
foreach($_POST as $post_key => $post_value) {
if (substr($post_key, 0, 7) == 'newlink') {
$posted_link = explode('_', $post_key);


And the HTML

<input type="text" name="newlink_1_1" value="" />
<input type="text" name="newlinkname_1_1" value="" />

There can be multiple languages and companies displayed on one page.

View 1 Replies

Changing Multiple Fields Within One Form?

I tried searching for an alternate thread about my dilemma, but couldn't fine one so I'm posting a new one.

I have a user editing page contained by one form, where values are fetched from an SQL table. Imagine it like this:

HTML Code:
<form name="userlist" action="" method="post">


So in essence I would need to find out which users have had their properties changed and then run a single SQL query to update all. Is this possible, and if, how ? Or do I need to run a query for each user separately?

View 1 Replies

Form, Posting Multiple Fields

I have a product list page, users can check the product then go to an e-mail form, that lists the products they checked.

On this, they can then chose a quantity for every product, how do I make it so when they send the e-mail, it gets the quantity for each product (using PHP mail, to send)?

The field would be:
<input type="text" size="4" maxlength="4" value="1" name="quantity">

But that wouldn't work for multiple ones? Would I use a "foreach" statement, somehow?

View 14 Replies

Select Multiple Form Fields To SQL?

i would like to submit the following code to my database as a mutiple selection box. when i submit i just get the last selected value for example if i hold ctrl and press 1 2 3 4 i am only receiving 4 on my database.

Code: [Select]Hours Of Availability:<br>
<select name="availability" multiple="multiple" size="9">
<option value="Monday - Period 1">Monday - Period 1</option>
<option value="Monday - Period 2">Monday - Period 2</option>


View 13 Replies

Comparing Form Fields With Data Base Fields And Highlighting The Form Fields?

the following two scenarios (PHP+MYSQL)

Scenario1: I need to compare the HTML Form field values with the Database field values and highlight the form fields in some color whose values are different from database values before submitting the form (to alert the user).

Scenario2: On loading the form, i need to compare the values present in 2 different database tables (tables are having different column names but the information is same). the fields which are not same needs to be highlighted in the html form to indicate the users that the master data is varying from secondary data.

View 2 Replies

Mail Function & Multiple Form Fields

I'm having some problems with a php mail form where I am wanting to
send information from 10 form fields in a e-mail. the way I have it
structured for the mail command is

mail ($to,$subject,$message);

where message is made up from the multiple fields from the form e.g

$message = "Name: ".$strName."
"Company: ".$strCompany."

The e-mail is sent fine but it only gives me the persons name and not
the extra fields.

Can anyone point me in the right direction?

View 4 Replies

Copyrights 2005-15, All rights reserved