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 Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Posting Form Fields
I have a form like the one below. Upon submit I would like to self post to the same page but have the original $_POST data( which was posted to this page from another ) also be sent along with the new form field data. How can I achieve that? Thanks. <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>"> <table> <tr> <th><input type="text" name="fields[]"</th> .... <th><input type="text" name="fields[]"</th> <th><input type="submit" value="Add" name="add"</th> </tr> </table> </form>
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?
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?
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?
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')";
To Search Multiple Words In Multiple Fields
I have a $phrase made of some words.Every query has a number variable of words. I would sort of my_table all records that have at least 1 word of the $phrase into field_a AND/OR field_b of my_table.
Posting Multiple Select
I'm having a little problem, in my form, I have to select multiple lines in a 'select' field and post it for processing. Now in the $_POST-variable, there is only the last selected item visible. How can I post every selected line?
Posting Multiple Queries
$sql = "INSERT INTO customer (custid,username,password,title,firstname,lastname ,street,towncity,postcode,telno,mobile,email,glass es) VALUES ('$custid','$username','$password','$title','$firs tname','$lastname','$street', '$towncity','$postcode','$telno','$mobile','$email ','$glasses')";INSERT INTO orders(custid,pid)VALUES('$custid','$pid')"; $result = mysql_query($sql); nothing happens. So I do a print "$sql"; and copy the result into a phpmyadmin SQL window The query works just fine. Anyone know why?
Posting And Validating Multiple Select
i have a multiple drop down with five items.. If i select 2 or more items and post, only one item is posted to the db! How do I make it post all the fields I have selected? Code:
CURL Form Posting To Self Referencing Form Action
I've successfully used CURL to maneuver around and through sites but a new site I've been trying to work with has got me stumped. To retrieve the data I'm trying to get a login is required. If you go to any page in the "member" area without logging in you get directed to a https connection and hit login.php (ie: you end up at https://www.domain.com/login.php). The problem, I believe, lies in the fact that the form on that page references itself in the form action tag. The action tag in the form is "/login.php" and nothing I've tried has been successful in getting CURL to actually submit the data and get me logged in. Not surprising really since you'd normally point CURL to the action target to pass form data. The things I've tried so far without luck are: * Hit the main site page to pick up the session cookie then go to one of the "member" only pages * Gone directly to one of the "member" pages to get redirected to login.php Both attempts end up simply returning me the contents of the login.php page which, obviously, doesn't help or do any good. What isn't clear from the CURL documentation with PHP is whether or not the CURLOPT_POSTFIELDS get passed to pages after a redirect takes place. I suspect they are but the fact that login.php refers back to itself seems to be the real problem. If anyone has any ideas on how to convince CURL to get me past login.php or any other suggestions on things I could try I would very much appreciate it.
Posting Multiple Variables To $_POST Using HTML Forms
This is my code : <FORM ACTION="php_steptwo001.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=3> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="test"> <INPUT TYPE="SUBMIT" VALUE"3 DAYS"> </FORM> Only the 1st Variable 'duration' gets passed!
Multiple Required Fields
I'm having trouble making a couple different types of fields on a <FORM> work -- when the form is processed, I have 2 types of fields I am trying to ensure the person clicks. If they don't fill out or click the appropriate field, the web page should notify them of this. name and address are simple fields where a person fills that in.ordertype is one of two radio buttons a person clicks on. I am detecting the fields that need to be populated, but cannot seem to detect when a radio button is not clicked on. Code:
Generating Multiple Fields Through A Loop
Is it possible to create a form where the fields are generated through a loop?Example: My database has 20 columns, I create a PHP form and use a loop to define the number of rows. The loop generates a table of 20 columns and 50 rows. After entering the data into these fields, I click add and another loop enters all of the data into the DB.I do know that this is possible by defining each variable in each field. But, it would take quite some time to define 50 or 100 fields. So a loop looks to be the easiest way in generating the 20 columns and 50 rows.How do I go about coding this?
PHP Handling Of Multiple Select Fields
If I have a select element of a form that have the MULTIPLE attribute with name="temp", what will the variable names be in the action page (POST)? Will the first one be $temp[1], second $temp[2] and so one? This does not appear to be the case.
Update Multiple Fields And Rows
I am trying to create a form that can update mutiple fields in a mysql database. I need it to be able to also update mutiple rows of the same field. The code below doesn't update, it actaually delets all data from the 4 rows. PHP Code:
Searching My Database For Multiple Fields
I have a number of different tables containing a number of different fields and i want to give people on my site an advanced search. The easiest way to explain this is for you to think of it as an estate agent's website. People visit the site and search for houses based on a number of different criteria, for example they would have a number of diffent boxes they could narrow a search down such as 'number of rooms', 'type of property', 'price' etc... Now this is similar to my site, I want people to b able to choose to narrow there search down but not be forced to enter information into all boxes. So i want a search where a user would be able to select the number of rooms they want a property to have but if they choose not to enter that information then the intial value of '0' (or null) would be submitted to the search query. A user should be able to enter number of rooms AND/OR property type AND/OR price. IF they dont enter that information then a value of '0' (or null) would be submitted for each of the options to the query however if they do select a value then this would form the query. This is where im struggling. After racking my small brains and trying to think logically about how i would do this, my logic tells me (and correct me if im wrong) that if i choose too insert each variable 1 at a time into a search query such as $search_result = mysql_query("SELECT * FROM tablename WHERE rooms='$rooms' AND type='$type' AND price='$price'",$database); ...then if a user hadnt entered how many rooms but had entered 'flat' as the property type they wanted then the sql would be searching the 'rooms' field for 0 (which it obviously WONT find) AND 'type' for 'flat' and will return no result even if a 'flat' did exist in the database What I have considered is building up the query as i go, so for example. Code:
Mysql_query: Select From Multiple Fields
I'm writing a very basic search script. I have a form field where I want to accept both first and last names. In my database, the first and last names are in separate fields. I want the query to go through both fields and come up with results. Here is the PHP code so far (only searches first name): $search = $_POST['search']; $data = mysql_query("SELECT * FROM customers WHERE fname LIKE'%$search%'"); //Display results while($result = mysql_fetch_array($data)) { echo $result['fname']; echo " "; echo $result['lname']; echo "<br>"; } How can i change this around to perform the way I need?
PHP/MySQL Sum() Works But Need Sum With Multiple Fields
I have a query that returns the total amount of items in a shopping cart: $sqlStr = mysql_query("select SUM(`price`) as total from `mr_cart` WHERE `cart_session_id` = '$sid'") or die(mysql_error()); The table mr_cart has two fields, price and quantity. I need to get the total for each line's price * quantity.
Form Posting
1. How can I now the url that posting the form? ex: I make a php page name poster.php. There is a form that has action to recipient.php. Then I need check that the form is surely posted from poster.php. 2. Can I post a form from to the other site that has different host? How it could be?
Form Posting
i have a form that points to a document on my local site, like: <form action="test.php" method="post"> <input type=hidden name=value1 value="something"> <input type=submit value=submit> </form> now, i would like to post the form data to the test.php file, from another php file (let's say test2.php)! how to do that? i cannot call http://localhost/test.php?value1=value1 because the method is POST (it doesn't work)?
Update Multiple Rows And Fields. Simple?
Hi. Im trying to create a form which will enable the user to update mutiple rows and fields, using checboxes to select and a submit button. The code below updates the field, but it always inserts the last row in the db. It inserts it in the selected row number (catalog), but it inserts the same data over an over (the last row in the db). Also, if more than one checkbox is selected, I get error Error in Query: >>>UPDATE catalog SET Name='Fred' , StreetAddress=űű yadda, City='somewhere' , Country='USA' WHERE catalog=(8,30)<<<. Error: You have an error in your SQL syntax near ཚ)' at line 1 (8,30) are the numbers/checkboxes I selected and the data (fred, etc.) is from the last row, and is not what I type in the text fields. Ideas? Thanks.
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:
Session To Query Multiple Tables & Fields
I'm trying to load up data where by the session is carrying the user ID.. and i need the session to call up the user table which is working fine. But i also need to call up info about gangs that the user is in. Now it gets complicated cos the user could be 1 of 30 members (30 being the max a gang gang can have). But how is this done? This is what i got at the moment. But this is only calling up the one table. I need this now to also check if the user ID is in another table which could be in a possible 30 fields. Code:
Mapping Radio Button Set To Multiple Fields
I've been staring at a form for about a day now and hope a fresh set of eyes can shed some light on it. It has a couple of issues, but here's the first: I'm trying to map a set of four radio buttons to eight fields in a MySQL database. If you select Radio Option 1, for example, that value should be passed into SQLField1, the now() value passed into SQLField2, and SQLField3 through SQLField8 would be passed no value. Code:
Form Data Not Posting
I was reading the forums and have not found the answer and could use some help. I am a novice and am learning how to do this out of neccesity for my non-profit org. I have a database with incidents that we react to during emergencies. I want to be able to have the users call up the record via ID (that works), change the status and/or details and save update mysql. It is just not saving the data. PHP Code:
Form Not Posting Variable
I have a form which has a select box form and a text box form. for some reason I can't get the Select box to pass the variable to the php file PHP Code:
Form Posting Difficulty
I'm doing a login form and i am trying to get it to post to a page that would vary based on the username given. I have figure out how to display all the info once it is posted. I mean i know how to select it from the db but other than that i'm kinda at a dead end. so far i have the following code snibblets: Form Login <html> <head> <title>login</title> </head> <form method="post" action="main.php?user=$_POST[username]"> // basic login form here with username and then username text box and then password and then password box and then submit button. // the name of the username field is username, name of password field is password and then submit button field is submit. Display page
Posting A Form To Another Script ?
Is there a way to "post" a form to another php script? For example input.php retrieves some user variables then posts the results to another script , say form.php? I know this can be done using perl's LWP by creating an agent. Let me know if this makes sense or not? I know I can use GET, but I want to avoid GET for some other reasons.
Posting To Php Without Html Form
I am quite familiar how to create a php page that POSTS or REQUESTS variables sent by an html form HOWEVER, I am wondering if it there is a way I can post variables to another php page or page in general, with php, and skip the form all together, for example: I have this page that POSTS information from an html form it make $id = $_POST['id']; this page is called formprocess.php now what i want to do is instead of having to use the html form to actually submit this data to formprocess.php, i want to submit this data with php I have a page called send-data.php i want this page to send the 'id' variable straight to the formprocess.php page with no html form.
Posting Form Data To Two Php Scripts At Once
How do i post the form data to different php files at once. I tried the following code but it doesn't work. the data is sent only to the first php file. <form method="post" action="insert.php" action="mail.php"> Email<input type="text" name="email" value ="" size="20" /> <input type="submit" value="submit" /> </form> Is there a solution?
Libcurl Form Posting Problem
I've been trying to write a short script using curl w/ php but can't figure something out: I'm simply trying to login to a website using a posted user/pass combo to an html form (login.php) that, if correct, sends a Header("Location: success.php"). The problem I'm running into is when I successfully login, i'm watching the logs and it's actually executing success.php but after that's done the screen just refreshes and stays on login.php... does this have anything to do with the session variables that are written to tell the system that I should be logged in? Does this make sense? Below are my opts. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_HEADER,0); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); $curl_output=curl_exec ($ch); curl_close ($ch); echo $curl_output;
Form Suffers From Premature Posting
I have created an HTML form that has the form action set to: <form action="forms_orderconfirmation.php" method="get" name="FormName"> My intention was to create a confirmation page with a submit button that the client would select after confirming that their information was correct. My problem is that the information gets posted to my email merely by linking to the confirmation page. It does not wait for the clients final approval. In fact the submit button does not submit anything... but going to the page does. code:
-> How To Read A Form Variable Before Posting? <-
is there a way to read the content of a form variable before a POST? I have a form with a "duplicate" button which opens a new form with most of the fields filled with the values of the calling one. To do so, I pass the id of the form to be duplicated. Example: - I have a form with "Number = 1234567" in a "numform" edit field. - Duplicate has a href=/duplicateform.php?id=1234567 - then the "duplicateform.php" reads id with a GET['id'] This is easy as I come from a displayed form that retrieves its values via a SQL statement and with a specific "number" reference. Now, once I am in this new form, I have a save button to save all values, including the new "Number" the user would type in, say "22222222". The save process works correctly via AJAX and saves the record using a POST action. But then, I still have my "duplicate" button which should now point to href=/duplicateform.php?id=22222222 How can I get this 22222222 value from within the form itself? I have to get it from the "numform" field, but how can I do this? it would be something like href=/duplicateform.php?id=<?=[value_of_field_number]?> with value_of_field_number being the actual value of that edit field.
Posting PDF Form Data To MySQL
I am working on a script that will take information submitted from a pdf form and store the field data to a given mySQL table. I just cant figure out what is wrong with my script. I am able to get the data from the pdf form, and set it as a variable so I can work with it in php. It is displaying the proper data when I echo() it, and I get no mySQL errors. It looks like everything should work, but when I check my database, nothing has been updated....
Posting From A Form Without A Submit Button - How?
Given something like: if ( $_POST['type_save'] == 'Save record to HTGI public DB') { echo '<form method="post" action="populate08.php">' echo '<input type=hidden name="kw_tarea" value='.$tk.'>' echo '</form>' echo '<p>permanent DB updated' } But there's no button to press for a submit. So how do I get this code posted to the action=populate08 ? Without pressing a buttom but just from the code?
Posting Form Data To Two Scripts At Once
From: "Norman Peelman" <npeelman@cfl.rr.com> Subject: Re: posting form data to two php scripts at once Date: Sunday, December 17, 2006 12:06 AM <one.1more@gmail.comwrote in message news:1166317725.715320.309280@80g2000cwy.googlegro ups.com... Quote:
PHP Event Calendar Posting Form
I'm using the basic PHP event calendar tutorial that is on this website, and I made a form to add the events. The problem is that the date isn't posting right into the MySQL. For the date it says: '0000-00-00' instead of what I inputed. Code:
Posting Form Variable Using Header()
I know I have seen it somewhere but cannot find how to do it right now. How do I use header to submit post vars "without" a form. The company I work for is using a 3rd party email marketing company (until I can get the time to build a system to bring it in house), and this company is working with me to keep the form, thank you and error page aspect on our site. I need to take the variable from the form and process them to do some validation and then send these post vars off to their page so it can be inserted into a database. They don't do any validation on their side with this setup so I want to do it on my side and use header() to submit the post vars.
Posting Information From A Form To A Text File
I am trying to append the results from a form to a text file. My code is supposed to print out the results on one page, and append the results to another page each time data is entered on the form and the submit button is hit. Unfortunately, it is only printing out the message acknowledging the submit button--no data on either form. Code:
Posting To A Form With Image Verification With CURL
this code keeps posting the wrong image verification code, to the form, because when it loads the form again to post the code that I retrieved the image verification code, is now changed How can I do this successfully with curl? If you have any experience with using curl functions in php you CAN help me on this one....
Security Issues With Posting Form Contents To Server?
I'm currently reading a php book that attempts to declare the security hazzards of not screening a form's content before allowing it to be posted, whether to a database, text file, or otherwise. Honestly, I still don't get what the problem is. Lets say magic quotes is turned on. Could someone list the major things I should still be doing to prevent security problems? For example, the book says to use htmlspecialchars(), though how does allowing the user to enter HTML tags compromise anything? The data simply gets posted as is to a database, then output as is Maybe an annoying JavaScript is output, but hardly a security breach to the server itself as far as I can tell.
Blank Response By Curl When Posting Form Data
Here is my code, and the problem: $st="...(string to post is formed from different variables read from file)..."; $lngth=strlen($st); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $url2); $fp = fopen("example_homepage2.txt", "w"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,20); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDSIZE, $lngth); curl_setopt($ch, CURLOPT_POSTFIELDS, $st); $page2=curl_exec($ch); curl_close($ch); fclose($fp);
Posting Data To Another Form And Getting Handle Of The Opened Window.
I have posted a form to a PHP file in a new window with target attribute. My problem is that my application should not allow user to post the form again. User should close the window and then only (s)he can post the form again. Can we get the handle of the opened window? If we use window.open then we will get the handle of that window but I am unable to post data with window.open. Any idea on posting data to modal windows. Not as parameters but as $_POST.
Curl: Posting Form Variables Results In Redirection
I'm using the curl functions in php to scrape the wan ip address from my home router (the router is an SMC product). This is a two step process: 1. post the password value to the login.htm page 2. capture and parse the content from the status_main.htm page On the SMC's login.htm page there is a form with the following elements: <form name=tF method=post action=login.htm> <input type=password name=pws> <input type=hidden name=page value=login> <submit value='LOGIN'> Here are three test cases - only the first two work as expected. I need to understand why I got that third response... posting the variables causes a the SMC to give me a redirection to index.htm which does not exist? COMMAND LINE TEST (returns login.htm and status_main.htm accurately): curl -d page=login.htm -d pws=mypassword http://10.10.10.1/login.htm curl http://10.10.10.1/status_main.htm | grep 'wan_ip' PHP NO-POST TEST(returns login.htm accurately): $ch = curl_init("http://10.10.10.1/login.htm"); $strIP = curl_exec($ch); curl_close($ch); PHP POST TEST (returns an unexpected result): $ch = curl_init("http://10.10.10.1/login.htm"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "page=login&pws=mypassword"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $strIP = curl_exec($ch); curl_close($ch); print "<!-- $strIP -->"; <!-- <html><head><meta http-equiv=refresh content=Ɔ url=/index.htm'></head></html> -->
Blank Response From Curl When Posting Form Data
Here is my code, and the problem: $st="...(string to post is formed from different variables read from file)..."; $lngth=strlen($st); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $url2); $fp = fopen("example_homepage2.txt", "w"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,20); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDSIZE, $lngth); curl_setopt($ch, CURLOPT_POSTFIELDS, $st); $page2=curl_exec($ch); curl_close($ch); fclose($fp); I tried both with and without POSTFIELDSIZE option, with same result. This code works fine for strings smaller than 800 characters (actually 795 or so), but my regular string is just under 13000 characters. I have uploaded the script to 5 webservers (including my development machine with Win XP , PHP 5 and Apache 2.2.) and it only works on one. The rest return a blank page to stare at on the curl post. Is this some configuration issue, or a curl issue?
Process Form Fields
Hi, I need to process a generic html-form. Is there any way to access to the form elemts as an array?
Trying To Duplicate Form Fields.
What I would like is to when someone writes in one field. The same text is written in a seperate field. But without sending anything. all internally. Anyone have a clue?
|