Submitting Multiple Form Fields In An Array / Loop
I have the following form
<FORM NAME="form1" METHOD="POST">
<?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>
</select>
<?php } while ($row_rs = mysql_fetch_assoc($rs)); ?>
</FORM>
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
ticked)
so far I have this:
<?
foreach($approve as $aID) {
$insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES
('$aID','')";
}
?>
How do I enter the select value within this loop?
I assumed that it would be just
$insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES
('$aID','$select')";
View 3 Replies (Posted: July 17th, 2005 10:42 AM)
Sponsored Links:
Related Forum Messages:
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 domain2.com from frame with URL domain1 . Domains, Protocols and Ports must match. form code: <form id="hiddenform" method="post" enctype="multipart/form-data" action="http://www.actonsoftware.com/acton/forms/userSubmit.jsp" 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){ [Code]....
Posted: Jun 16 at 17:51
View 1 Replies!
View Related
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: Opens: <select name="starthour1"> <option value="00">12</option> <option value="01">1</option> <option value="02">2</option> [Code].... 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.
Posted: Jul 8 10 at 17:06
View 4 Replies!
View Related
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.
Posted: 10:10 pm on Sep. 9, 2004
View 1 Replies!
View Related
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. edited: SO is this normal that the post isnt giving me the file name? is the file still saved as temp on the server?
Posted: Aug 2 10 at 18:04
View 3 Replies!
View Related
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"> [code]...
Posted: Jun 18, 2009, 06:17
View 5 Replies!
View Related
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. <tr> <input type="hidden" name="id" value="10"> <td>SKU<td> <td>Product Name</td> <td> <select name="product_category" value="" tabindex="4"> <option value="1">Category 1</option> [Code].. 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?
Posted: Sep 29 10 at 18:30
View 1 Replies!
View Related
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) VALUES (' . "'" . mysql_real_escape_string($_SESSION['custNum']) . "', " [code]...
Posted: Oct 16 10 at 19:29
View 1 Replies!
View Related
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("http://www.atouchofmoore.net/certificate_stage3.php" array( <?php [Code].... 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.
Posted: Jun 15th, 2011
View 3 Replies!
View Related
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 [Code].....
Posted: 06-14-2010, 09:44 AM
View 2 Replies!
View Related
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: [code]... 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.
Posted: Posted 13 May 2009 - 12:44 PM
View 4 Replies!
View Related
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 title|author|publisher|etc title|author|publisher|etc title|author|publisher|etc 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?
Posted: April 7th, 2002, 05:07 AM
View 2 Replies!
View Related
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).
Posted: 08-03-2005, 07:35 AM
View 9 Replies!
View Related
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?
Posted: July 17th, 2005 02:57 AM
View 2 Replies!
View Related
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?
Posted: April 23, 2007, 11:40:41 AM
View 14 Replies!
View Related
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'];?>" /> [code]....
Posted: Dec 11 10 at 12:25
View 3 Replies!
View Related
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); [code].... 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.
Posted: Jan 22 at 21:33
View 1 Replies!
View Related
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"> <table> <tr> <td>username</td><td>level</td></td>active</td> [Code].... 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?
Posted: 06-29-2010, 07:16 AM
View 1 Replies!
View Related
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> [code]...
Posted: January 15, 2011, 09:36:11 PM
View 13 Replies!
View Related
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.
Posted: Nov 9 09 at 13:01
View 2 Replies!
View Related
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?
Posted: July 17th, 2005 05:43 AM
View 4 Replies!
View Related
PHP Mailto Form Multiple Fields MySQL
I'm trying to edit a email form that is about 30+ fields. Right now the form only inserts the data to a MySQL DB. What I would like to add is an email (mailto) feature that sends the entered data from the form to an email address as well as add it to the DB at the same time. I'm not a beginner in PHP MySQL but not quite a novice just yet.
Posted: April 26, 2007, 09:16:34 AM
View 4 Replies!
View Related
Using Post When Multiple Form Fields Share Same Name And Id?
That title probably doesn't mean much but what I have is a form that is generated dynamically. I hooks into a table of products, pulls out there name. I then create a form that displays the product with a checkbox and textbox next to it. <form id="twitter-feed" name="twitter-feed" action="<?php echo $this->getUrl('tweet/') ?>index/tweet" method="post"> <table><tr> <?php [code].... As you can see there are checkboxes and textfields for each record. When I examine the $_POST data from the form it only retains fields for the last record.
Posted: Nov 19 10 at 13:57
View 5 Replies!
View Related
HTML - Form Handling Multiple Fields?
What would be the best way to intercept multiple fields via PHP? Currently I have a login.php file which is pretty simple: <form method="POST" action="auth.php"> Code:<br /> <input type="text" name="code" /> <input type="submit" id="submit" value="Submit" /> [code].... Then in the auth.php I get the value via the POST: $value = $_POST['code']; The problem with this is that I would have a quite amount of fields, and every field would have a submit button assigned. Then I would need a if condition for every field name available, which I don't want to.
Posted: Oct 30 10 at 23:07
View 3 Replies!
View Related
Passing Multiple Fields From Query In A Form?
I am writing a module to add users to my system. Getting the details from the query is fine but I'm having all sorts of issues passing the fields in the form. This is the code: PHP Code: $search=$_REQUEST['search']; $username=$_REQUEST['username']; mysql_connect("00.0.0.00",xxxx,xxxx); @mysql_select_db(DBDESC) or die( "Unable to select database"); [code].... I need only the fields that I have selected to be passed when the submit button is clicked. I tried using a drop down menu with the query result as the options and I have tried using radio buttons and the wrong data is being passed.
Posted: Mar 9, 2009, 03:49
View 4 Replies!
View Related
Creating Sticky Forms For Multiple Form Fields?
I am attempting to create a program for a local auction house. I arrived at a stand still on a certain issue which is creating a sticky form. On the "enter auction details page" the user will be entering data as the auction is in session. 1. item Description 2. Item Price 3. Bidders Id 4. Qty Of course it would be repetitive to require the user to keep entering the same data for every bidder, so I want to stick the obvious fields which are "item description" & "Item Price" as these don't change until a new item comes up for sale. As of know I am processing the input on a separate page which records all input to the database with a redirect back to the "enter auction details page". I have tried many times to get the item description and item price fields to stick. These would need to change as the user moves onto the next item in which the description and price would change as well. Here is my current code for this part: Code: [Select]<?php session_start(); $field_itemDescription = ""; //iyem description, default as blank [code]....
Posted: August 25, 2010, 12:18:16 PM
View 1 Replies!
View Related
Sorting An Multidimentional Array By Multiple Fields
If the multidimentional array was a mysql TABLE, what i'm trying to do would look like this: SELECT * from array WHERE 1 ORDER BY field1 ASC, field2 DESC, field3 ASC and so on. I already constructed a function do to so, but this function, or should i say these 2 functions, sort only the first field properly, and then any other field is sorted improperly. PHP Code:
Posted: December 30th, 2001, 11:29 AM
View 5 Replies!
View Related
Post Form Fields Into Array - 'group' Each Form Field
A user can choose a number between 1 and 10 from a list box. Based on the value of their choice I display the same form 1 - 10 times on the page and this form is there to collect personal data. Each form will have a small number of text fields and also some checkboxes e.g: name (text) dob (text) option 1 (checkbox) option 2 (checkbox) option 3 (checkbox) (note the checkboxes should be grouped as an array as they are dynamically built) My question is, how do I 'group' each form field so that when the page is posted (saved) I can capture the correct data for each form filled in? I know arrays are involved somewhere here but not sure how it is implemented.
Posted: 04-14-2010, 06:08 AM
View 4 Replies!
View Related
Codeigniter Form Validation Callback Checking Multiple Fields
I have this controller set up for a login: <?php class Login extends Controller { function __construct() { parent::Controller(); $this->form_validation->set_error_delimiters('', ''); $this->output->enable_profiler(TRUE); } [Code]..... What I am looking at is the line that does the form validation callback >> $this->form_validation->set_rules(array('username','password'), 'Username', 'callback_terminal_login_check[$username,$password]'); I know this is not right. Basically what I want to do is check the username and password against the Authentication->DoTerminalAuthentication model to process the user's login. I want to pass the $username and $password form fields. [Code].....
Posted: Aug 20 10 at 14:16
View 3 Replies!
View Related
INSERT Multiple Records From FORM In LOOP?
I have this aproval form where the inserts come from a loop... How do I get all these records into my db table? Form: PHP Code: echo '<form action="insert.php" method="get" name="form1">'; $sql="SELECT * FROM ".$prefix."_users ORDER BY rankpoints DESC"; $result = mysql_query($sql); [code].... And insert.php: PHP Code: $rank = $_POST['rank']; $points = $_POST['points']; mysql_query("INSERT INTO ".$prefix."_users (rank,rankpoints) VALUES ('$rank','$points')")
Posted: Mar 24, 2009, 16:35
View 3 Replies!
View Related
Form Validation For Fields In Array
I've writen the script and it all works now I want to do some validation to make sure the user enters a 'correct value', simple enough you might think, anyway what I have is 40 fields in my form which are sent to 5 different arrays for processing, so: $q1 = $_POST['q1']; $q2 = $_POST['q2']; $q3 = $_POST['q3']; //....... //then $typea = array( '1' => $q1 , '10' => $q10 , '11' => $q11 , ........ '40' => $q40); //so now I want to validate... $check = 0; foreach ($typea as $key => $value) { if ($value != 0 || $value != 2 || $value != 3) $check = 1; echo $value . " , " . $check . "<br /> "; //to make sure values are what i think } if ($check == 1) //go back to form else //do the processing $check always returns as 1 though, even when the values are 0 , 2 or 3
Posted: March 10, 2007, 11:40:27 AM
View 5 Replies!
View Related
Store Form Fields To An Array
i have a form which consists of several fields for name, address, number etc. i use a php form to process this and output it onto a html form. the thing is, i'd like to store the information in an array. so for each user, the array will have their details. and this can be printed on the screen. can you tell me how this is possible. i have seen examples of arrays, but the values are assigned to the variables already.
Posted: 03-19-2006, 04:30 AM
View 1 Replies!
View Related
|