Form Post Method
I am new to PHP. have worked in many languages in the past.
I have a HTML page which posts back to the mail.php which mails the
contents of the input text boxes. I wish to impose some error checking
on the HTML form with JavaScript. How do divert to the javascrpit
method and then do the POST after all checks OK....
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Form Method Post Does Not Work, But GET Does
I have a form, if it uses method get, the variables gets passed. In the response page, when I print out the $_GET array, it prints out all the values passed in from the from. BUT, if I use the form method POST, the $_POST array is empty. I don't understand why it isn't working for $_POST. The register_globals variable is set to Off by the way. PHP Version 4.1.2 Red Hat Linux release 7.3
Email Form Does Not Submit Data In Post Method
I have an email which contains a whole form to be submitted to the php code. When I use get method, it works properly, but when I make it to POST method, it does not work. Also, same HTML code as an pure HTML page works properly for POST method. What can be the problem? How can I make the email to submit the data through POST method? My HTML code for email : ==== <form name="form1" method="post" action="getSurvey.php" target="_blank"> ==== My php code : ==== reset ($HTTP_POST_VARS); while (list ($key, $val) = each ($HTTP_POST_VARS)) { ====
Get Method Works But Not Post Method On PHP 5.0.4 Pages
I am unable to display PHP pages generated by a submission of a form using a POST method. To illustrate this, I created a very simple form called TestForm.php . <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test Form</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr><td>Name</td><td><input type="text" name="name0"/></td></tr> <tr><td>Age</td><td><input type="text" name="age0"/></td></tr> </table> <input type="submit" name="SubmitMe" value="Submitted" /> </form> </body> </html> I first set the method for the form to GET and the page loaded again after the submit. When I changed the method back to POST, I received a Page Not Found error page. I created another page testform3.php to display the Form Values after submit. I changed the action on the form to testform3.php.
Method Not Allowed The Requested Method POST Is Not Allowed For The URL /rob.html.
THis is my code. What im trying to accomplish is the user fills out the form then when they hit submit it displays what the entered on the samne page but i get this error message when I hit submit Method Not Allowed The requested method POST is not allowed for the URL /rob.html. Here is the code. Any helpis greatly appreciated I cant figure this out at all i have tried so many different combinations. <?php $firstname=$_POST["firstname"]; $lastname=$_POST["lastname"]; $phone=$_POST["phone"]; $mobile=$_POST["mobile"]; $besttimetocall=$_POST["besttimetocall"]; $city=$_POST["city"]; $bizname=$_POST["bizname"]; if (!isset($_POST['submit'])) { ?> ..............
Post Method
I have an HTML form in which a user enters his/her name and once clicked submitted it should run the process form and show the name user entered. The problem is that the variable "username" is not been passed to my processvariable.php through html headers. Code:
POST Method
I would like send variable to php script from URL using POST method. Is possible do it ? ( <a href="xxx.php">)
POST Method
I need to make some interaction between 2 diferents php site. For that, in 1 site I have a php function, it wait for some values on the POST method. It verify the value and return a xml with the result and one unique ID if all is well or the error code. This function I can not modify it and I can not any access, I can only use it. In my side I try to do a form with all values, put in the action the url and submit button, but I was able to catch and work with xml, always the xml is show in the browser, I wan not do that, I can catch the xml, work with the xml and show some information on the browser. (all in the same page)
Help Using The POST Method On PHP
I need to pass a value into a hidden form element by simply clicking on a link, and the value passed should be the visible name of the link itself. Can this be done without Javascript? This php page will be accessed on mobile phones, and Javascript support on them is very limited, so I must deal with it using only PHP.
CURL + POST Method
I am currently coding a small script to put data to other website by "curl" this web site cgi script. OK, now let me introduce some backgrounds. The PHP variable of the url of the CGI script on that site is: $url = "http://www.example.com/index.cgi?"; Original CGI on that example.com site read the form data data_a and data_b in <input type=text> and <input type=textarea> by POST method. Two data I need to fill to this CGI script by my PHP script are: Code:
POST Method And Xls File
Normally users compile a php page to introduce some informations, then these infomations are put-in in 10 different array and with POST method passed to a result php page that elaborate and give result for the information just inserted. Now, I want to use a tablesheet in excel to introduce information in more flexibility mode, and I want to use my php result page to perform the same elaboration. Have you an idea how to build the array post variable ?
POST Method And The Quotes.
I've a problem with POST method and the quote. When i get a data in mySQL database, the data is displayed correctly with the quote. But, when i put my data into POST method, all characteres after the quote are not displayed correctly. For example: it's = it'. Why the POST method make this error and how to delete this problem?
405 Post Method Not Allowed
I've searched the web for a solution but to no avail. I have just setup and installed Apache 1.3.20 on windows, and php 4.0.5. Apache is up and running, (In directory F:programsapacheapache) and PHP has been copied to both c:php and F:programsapacheapachephp. I've put the php.ini file in c:windows and made the following changes: doc_root = "f:programsapacheapachehtdocs" extension_dir = "c:php" While in httpd I have added: ScriptAlias /php/ "C:/php/" (uncommented) AddType application/x-httpd-php .php Action application/x-http-php "/php/php.exe" Anytime I try to load a php script I get a 405 error stating that: The requested method POST is not allowed for the URL /password.php.
POST Method, Textfield And URL
Is this possible? Im using POST method, Can i give, say a textfield named "textfieldname" a value using url like http://localhost/site/file.php?textfieldname="myvalue"
Is There A Size Limit On POST/GET Method?
I have a form that posts data to a PHP script which adds a record to a database. One of the fields in the database is a text field and I use a textarea to take the user input. It's been working fine until the other day when someone tried to add a record, the only odd thing was that the textarea had more than 1800 (ish) characters. If we add say 1500 characters the data posts fine and the record gets added. Is there any way of getting around this?
Method Post Not Allowed Error
When I include a METHOD=POST in any script I get an error message "Method Post Not Allowed" when I run the page from a workstation.
How To Read The Body Of A POST Method?
I need to read the BODY of a POST. Getting normal POST variables is clear enough, just use $_POST, but the body does not seem to be included in this array. I don't have control over the POST itself (it is a notification from a mobile phone, since you ask), and the format is odd. Rather than: <name>=<value> it is: <code><space><label> eg: 900 Success How can I read the body text? I don't mind getting at the whole content and processing it, if necessary.
Cache Post Method With Php (search Results)
when you're searching and you click away from the resulting hits page and want to come back, you might get this messae: data has expired from post method .. blah-blah .. could be annoying, because if the pages use sessions the soulution that U'd think of doesn't seem to work, but instead U got2 use this line: session_cache_limiter('private, must-revalidate'); (cuortesy (borrowed it from) of php.net, users contributed section at headers) that person sais the "must revalidate" part is crucial .
Parsing Info From Other Page (method POST)
- i want to get some info from the page XYZ to my page. XYZ page has a FORM where you can select DAY, MONTH, YEAR and you get the info about a day you selected. - now, if i want to grab the info from let's say 20. august 2002 my url will look like this: http://XYZ/file.php?day=20&month=8&year=2002. - THE PROBLEM is, their form has the POST method, which means, if i want to direct link the 20 august, it will bring me to the FORM page and not to DATE page. is there any ways to bypass this?? I REALLY NEED THAT INFO?!
Variable On Post Does Not Captured On Function Method
i have a form that passes a value on the form using this.. <form method='POST' action='fpass1_collect.php'> Telephone: <input type='text' name='Tel'> </form> on fpass1_collect.php - $v_tel = $_POST['Tel'] ; and i have a function read_template1(); when i load the read_template1 the values passed on the form does not display, but it run the function but its blank, any ideas?
Passing Variables In Frame Page By Post Method
Is it possible to send variables by post method through a submit button to a frames page, and have all 3 pages in the frame pick up the variable using the $_request[var] ?In other words, I click on a submit button. in form action method call index.php the index page has a top, main, and a left frame.how do i get each one of those to receive the variable, when i can only sendit to one page? or is it possible to send it to more than one page, but only action to one page?
How Redirect A User To Another Page And Send Some Variable With The Post Method?
I make a user registration. It contains two/more page. First page is for official purpose. User ID, password and some other official information is in first page and user basic information is in second page. If user enter an user id that already exist in database then a message show the same page to change his user id otherwise page is redirect to second page and send user id, and other variable that was in first page. My Code:
Execute Ancestor Method Before Descendant Method From Another Method
Is there any way to invoke the ancestor method and then the descendant method? I'm not saying: parent::method(); ... <script for the current method> What I'm looking for is to manually execute the ancestor method (bypassing the descendant method) and then execute the descendant method from 'another' method. All of this execution is done from another method. Reflection class or something?
Fsockopen For Form (vai The GET Method) With Sessions
I'm trying to submit a form but i'm having a slight problem which i was wondering if anyone here could help with. The problem is to do with EveryDNS (www.everydns.net). If you take a look at EveryDNS you will notice like a lot of other sites its based on accounts. I've tried to create a short function in PHP using fsockopen. This function logs into my account which uses sessions (i think its sessions anyway - looks like it). The problem is i then have to navigate to another web page in there to do the stuff. Does anyone know of a good way i can login via the sessions then move over to the page for the zone file for a domain like mydomain.com then add new records and so on?
If Value Contains & And I Am Using Get Method Tp Pass Data To Another Form
i am using get method to pass data from one form to another and my value may contain & symbol. so when this is case the value after & sign is truncated which is logically true. so what should i do to solve this problem and if value contain ? symbol then it will make any difference????? i have not checked this but just it came in mind right now so i am asking you. is there any otehr characters which i should consider except & and ? while using get methos to pass data from one form to another
Problem To Get Data From A Form (method=get)
i am using redhat8 with default php installed, the problem i am facing is that: #test.php <?php echo $test_value; ?> localhost/test.php?test_value=abc whatever values i try, php can't get my values passed by get or direct url passing.
"Post" Method
Hello, i'm pretty new to php (I just use php require so far) and I've been hearing about the "post" method. Where you have one page with all the layout code, and the rest of the pages are just .txt files that you call up with what users click... Basically when you change a layout, you change one page, and all your content is saved in their own files.
Form Post
i am making a form but every time it trys to send it it has to send it through outlook i wont the page to send it by its self without it coming up about outlook and stuff or is there a way i can send it to a text file if so is there a good tut for it.
Form Post
I am using 15 text areas for the user to put in 15 names. so we have user1, user2,....user15. How can I do this below: $user1=$_POST['user1']; $user2=$_POST['user2']; $user3=$_POST['user3']; $user4=$_POST['user4']; $user5=$_POST['user5']; $user6=$_POST['user6']; to input the data in a table without actually having to type out 15 lines.
Form POST
I am having my data emailed to me, but the data does not seem to be picking up the user's IP address, the Browser type, the URL that he/she came from, nor the email address they are entering on the form. Code:
Post Data W/out Form
I want to post variables to a php script, but I do not want to use a form to do this... is there some sort of header I can use to redirect and post values to another page? Cookies and sessions are not an option, URL line ('get') variables can't hold large enough a string...
Form Post Doesn't Work
I have RH9 Linux with the versions of Apache and PHP that came with it. The PHP is version 4.2.2 on the CD, I believe. Apache, I think, is version 2.0. I found I can do some regular PHP stuff like pull data back from MySQL and show it, but posting form data from one web form to another web page simply doesn't work for some reason. Has anyone seen this? Example:
XML Form Post To External URL
I'm far enough along in PHP to know how to create input forms, grab the form input as $_POST variables, do some basic validation checks and present the errors to the user for resubmit if needed. For the life of me I can't understand why I can't post data as an XML document to one of my advertisers. For example, a lead form is complete with Name, Address, Phone, and so on. I capture the form data and submit as an XML document. This particular advertiser will only accept data as an "External XML Post." I tried using Javascript and PHP with cURL, but I'm going in circles trying snippets of other people's code -- it's been a week. At this point all I want to do is assume IE7 (nothing else!) and no data checks, just "here's the XML, here's the external URL" and show me that HTTP POST actually works. Right now I'm thinking it's a bunch of junk :-) Someone please help. Here's my server info: PHP Verion 4.4.4 Apache/2.0.46 (Red Hat) CURL support enabled CURL Information libcurl/7.15.4 DOM/XML enabled DOM/XML API Version 20020815 libxml Version 20510 HTML Support enabled XPath Support enabled XPointer Support enabled XML Support active XML Namespace Support active Here's a sample of XML, let's call it "data.xml" <?xml version="1.0" encoding="UTF-8"?> <DataFormSubmit> <individual id="12345"> <FirstName></FirstName> <LastName></LastName> <Address></Address> <Phone></Phone> </individual> </DataFormSubmit> POST XML document to URL on an external website for example: http://www.example.com/othersite/xml.aspx Response XML is equally simple. There is no mention of MethodCall, MethodResponse and Params like the books say, so please don't use those elements in your reply to me. There is mention of field requirements like "Text field" "255 character max" "Numeric" but I think this can be handled by the input validation scripts. I'm just trying to POST and get a response. I've received errors refering to "permission denied" "access denied" "object expected" but at this point I've edited my code so many times I don't know what's right or wrong any more. Here's one of my failed cURL examples: <?php // XML data as string $request = '<?xml version="1.0" encoding="UTF-8"?>' $request .= '<DataFormSubmit>' $request .= '<individual id="12345">' $request .= '<FirstName></FirstName>' $request .= '<LastName></LastName>' $request .= '<Address></Address>' $request .= '<Phone></Phone>' $request .= '</individual>' $request .= '</DataFormSubmit>' // Create Headers $header[] = "Host: www.example.com"; $header[] = "Content-type: text/xml"; $header[] = "Content-length: ".strlen($request) . " "; $header[] = $request; // Send using CURL $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "http://www.example.com/othersite/xml.aspx"); // URL to post curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); // special POST with specified Content-type $result = curl_exec( $ch ); // runs the post curl_close($ch); echo $result; // echo reply response ?> And I tried a Javascript variations using code like xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") but I'll save that for a followup post since this is getting long. Anyone out there doing external XML form post?
Php Post Script No Form
How to generate the headers to submit POSTED variables to a page? i know this will be brief, just need to know how to construct the headers with the posted var...
Form Post And Refresh
in my php program ,i posted some text field value from one htm from to php3 form,in this php form i insert all values in mysql db, but again if we refresh the php form it again insert into databse? please give me the solution for it?
Form Data Will Not Post
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most part, the scripts were created with http://phpcodegenie.sourceforge.net/
Form Post Issues
I have a webpage that uploads a photo picture file to server, but goes through some error checking before it redirects to the next page. Since I do not have PHP compiled with mime type support I have checking last 3 characters of filename. Here are my problems: 1) When I set form type to ENCTYPE="multipart/form-data" i can check the file size correctly and works fine, but then filename and extension are in some weird format which is binary I believe. form = 1 Photo: /tmp/phpnDF01W image_x = 89 image_y = 16 Ext: 01w < this is wrong, should be gif/jpg/etc... Size: 34326 File: /tmp/phpnDF01W < this is wrong 2) When I omit the above form type and use default, file size function fails but the extension and filename work correctly. I believe this is because it is sent in ascii/plain text mode. Warning: filesize(): Stat failed for C:WINDOWSDesktopsci.psd (errno=2 - No such file or directory) in /home/fcl/public_html/free/index3.php on line 30 form = 1 photo = C:WINDOWSDesktopsci.psd image_x = 66 image_y = 12 Ext: psd Size: ?????? File = C:WINDOWSDesktopsci.psd 3) I'm also trying to get the file to the server and it's not uploading it. It's creating the directories but not moving the file up there for me!! 4) Here is code. What is going on? Can I kill 3 birds with one stone here? I'd rather not recompile PHP. Must I convert $ext from binary to plain text? while(list($key, $value) = each($HTTP_GET_VARS)) { echo "$key = $value<br>"; } if ($form) { if ($photo) { $ext = strtolower(substr($photo, -3)); function fsize($photo) { return filesize($photo); } $size = fsize($photo); if ($size > 100000) { $focus = "photo"; $msg = "Your file size exceeds the maximum allowed upload. Please re-submit or skip this step."; } elseif (!preg_match("/(gif|peg|jpg|bmp|png)$/", $ext)) { $focus = "photo"; $msg = "Invalid file type. Please submit a gif, jpeg, bmp, or png photo."; } else { if ($ltype == "1") { $type = "hotel"; }<-- this all works fine, etc if ($ltype == "2") { $type = "inn"; } if ($ltype == "3") { $type = "bandb"; } if ($ltype == "4") { $type = "resort"; } $imgdir = "$DOCUMENT_ROOT/lodging/$type"; <-- this all works fine,etc if (!file_exists($imgdir)) { mkdir($imgdir, 0755); } $imgdir.= "/$aid"; if (!file_exists($imgdir)) { mkdir($imgdir, 0755); } move_uploaded_file($photo, "$imgdir/photo1.jpg"); <---this is not working!! loc("index4.php?sid=$sid&aid=$aid"); <-- works fine }} <form name="form1" method="post" action="<?=$SCRIPT_NAME?>?sid=<?=$sid?>&aid=<?=$aid?><ype=<?=$ltype?>" ENCTYPE="multipart/form data"> <input type="hidden" name="form" value="1">
Form Post Not Working
I've made a small script where my users can enter their usernames into a form and when they press submit it sends the username to me as an email. It doesn't seem to be working though. Check the Code:
Form POST To MySQL WHERE
I have a form that is posting to another page, and on that other page the posted elements fill out a MySQL where statement. It is posting school, state, and category. When each field has a value in it, it works fine. However, the default value of "All Schools" or "All States" or "All Categories" will not work. I've tried using a * and also an %. I've also just left the fields at value="", but after post, it considers that a value even if i'm using isset to check it. Any ideas on how to solve this?
Post A Form To A Different Website?
Perhaps, not a PHP question but I have a <form> variable that I need to access on a different website. <script language="JavaScript"> <!-- document.write("<form method='post' name='samplesearch' action='http://<my-website>'>"); document.write("<input type='hidden' name='data' value='<?=$data;?>'>"); document.samplesearch.submit(); //--> </script> This works in IE but now FF. Why? Security concern? Should I use cURL instead?
Sending Form POST Data To SSL
I've seen posts on here before about this, but I could never figure it out. I even downloaded the code that was posted and tried to pick it apart to get it to do just what I need, but never succeeded. What what I understand it deals with using Sockets and sending the header information. Maybe that's where my lack of knowledge lies. For a regular post it should be sent to port 80, and for SSL 443 right? How do you go about forming the header of the data? I've never seen that kind of thing, and I'm guessing that's where I'm goofing up. I'm trying to set up a test: index.php posts data to test1.php and then displays the results. $var1 = 'test' then test1.php would do something very basic like drop it into a line of text. "This is a <? echo"$_POST['var1']";?> of the gotspy broadcast system." So I would assume if everything worked right, going to index.php should return: "This is a test of the gotspy broadcast system."?? Yes, no?
How To Post Form Data After Validation
I'm posting the contents of a html form (I have the html form on the same file as the php mail()) to itself in order to validate and then send an e-mail. However, I'd like it to post it to another php file after upon successful validation. Can someone tell me how to do this? Just a bit of background - the reason why I'd like to do this is because I have multiple contact us forms on a site, and for efficiency purposes, I'd like to have a single form mail script so that I don't have to keep editing the php.
How Can A Form Set To 'get' Return 'post'?
I have a form which the user fills out to enter some data. If there already exists an uncompleted session - say, the user started entering some data but had to stop to do something else - the user has the option of selecting that session from a drop-down menu (think <form><select><option>....</option></select></form>). The method for that particular form is set to 'GET' and the action is $_SERVER['PHP_SELF']. The <selecttag has a bit of javascript (onChange) which, when the session is chosen, triggers a 'submit' of the uncompleted session's session ID number. So the user selects the uncompleted session, the session ID is looked up, the data retrieved, and the page reloads and shows the data which they (or someone else) already entered, retrieved from a mySQL table (using the session ID) designated to temporarily store data from uncompleted sessions until it is ready to be written to the 'permanent' tables. At this point the user should update any information if so desired, then click on "Submit" at the bottom of the page to update the table and go on to the next page of the form. This causes the same page to reload, validation is run, and if it passes it again reloads the page only this time it sets a flag to write a <meta> redirect tag to the page. The page is reloaded but instantly redirected to the next page (I couldn't use "header()" because the headers are already written). The validation script is part of the same document. There is an IF statement at the head of the validation portion - if ($_SERVER['REQUEST_METHOD'] == 'POST'). This should, in theory, prevent the script from running a retrieved 'open session' through the validation, at the end of which if everything passes validation the data for that session is updated (or if it is a new session ,inserted). It should only be invoked if someone presses the "Submit" button at the bottom of the page, which is set to "POST". So in theory, the validation should only be run when "submit" is clicked by the user, not when an open session is selected and "submit" is sent by the 'onChange' javascript. What's going screwy is that the open session's request method is coming back as "POST" even though it is explicitly set as "GET". So when an open session is retrieved, the page reloads, the validation is run, everything checks out so the data is updated and the browser loads the next page, without the user getting the opportunity to update any of the retrieved open session's data. I hope I have explained this clearly. Can someone tell me why the first submit - the one for the drop-down menu of open sessions - is returning POST even though it is set to GET? This is screwing everything up and I can't figure a way around it.
Form Post To Text File
I have a form that posts to my php file which in turn writes to a text file. The way I'm doing is probably far from efficient or the right way, but it's the first thing i've ever written and I have to get it done. The way it writes now is it just puts all the form input next to each other in a text file. I want each field to be delimited or on new line so I can read it easily. Here's a snippet of my code: <?php> $filename = 'orders.txt' $fp = fopen($filename, "a"); $string4 = $_POST["email"]; $string5 = $_POST["street1"]; $string6 = $_POST["street2"]; $write = fputs($fp, $string4); $write = fputs($fp, $string5); $write = fputs($fp, $string6); fclose($fp);?>
Odd Result From PDF Form Post Processing
I have a PDF form that contains a submit button with an associated action that causes the populated PDF file to be submitted to my web server, similar to POSTing an HTML form, but instead it happens via Acrobat, no HTML involved. Code:
POST Blanks Out Form Fields
I have a form that POSTs to itself and validates data entered into the form. If all is well the form performs a header location command to move to the next input form in the series. If the user has entered an error within the form the user is NOT redirected to the next page and error messages are displayed indicating the fields that are in error. So far so good. The only problem is that all the input fields are now blanked out after the post. These fields must display all the values that were inputted before the post was executed. I have tried the following to no avail...... reassigning values like this after the post => $zip=$_POST['zip']; reassigning values like this after the post => $fullname=$_SESSION['fullname']; Utilizing this Meta Tag => <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="CACHE"> How can I keep the data that was entered into the form fields before the post was executed?
|