Validation Errors From Displaying On Form Page Load Instead Of Submit
creating two forms and they work fine. Problem is that the validation errors display immediately on page load instead of on submit. Here's the full code for the form parsing: Code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Auto Submit Form On Page Load
i have a cronjob to run a php file at a certain time of the day. it originally was suppose to run the php mail function, easy enough, right?? but no, the php mail function is not enabled on the server - just my luck. all i need to do is send two values from a database table within an email. i was thinking, i could probably create a form which plugs the two values into fields, and use the mail cgi file to send it that way, but I'd need to submit the form on page load (without someone actually clicking the submit button). I could use javascript, but the cronjob would ignore the javascript. any ideas?
Submit Vs. A Fresh Page Load
I'm developing a page - mostly for the learning experience - that includes a form with several text fields and a submit button. When it's submitted, there is some server-side processing and the output is displayed as part of the same page. (the form's action attribute is set to: "<?php $PHP_SELF ?>"). One of the steps in the PHP script is to check for the existance of a hidden element in the form so that I know whether the page is being sent out as a result of a new request or from the form having been submitted. This all works as expected. When the page is sent out as a result of having been requested from its "home" page, the results are not shown; when the submit button is clicked, the page is sent out with the results shown. Finally my question: when viewing the page with the results shown, if I press <F5> or click on "Refresh", it behaves as if I had clicked the Submit button (that is, it shows the results). I would expect it to return the page as if it was a new request (and NOT show the results).
Session Var Is Setting ONLY AFTER I Reload Page, Form Var Displays First Page Load
Page1 has a form that calls Page2. The beginning of Page2: <? php session_start(); $s=$_POST['sSelected']; session_register("s"); ?> in the middle of Page2 I have a form varaible: <?php echo $_POST['stateSelected']; ?> <?php echo $_SESSION['s']; ?> The form var displays the first time the page loads. The session var displays only after reloading the page2.
PHP Form Processing Hangs Page Load
I am trying to write a simple PHP script to process a form.. the function seems to be working fine // subscriber is the users email in the form if (( $subscriber ) && ($_SERVER['REQUEST_METHOD'] == 'POST') ) thing is while this processing is taking place the page load hangs... in IE i see nothing the page background, in Firefox (even worse) I get only 1/2 the page.... I would like the whole page to load the the processign to take place, except that my PHP is 1/2 way down the page, inside the form
Reload The Same Page With A Form After Submit?
I have a page with a form, and the code to process the form answers, I want the same page/form to just reload when the user presses submit. The only function I have found is that location command. PHP Code:
Form Submit -> Receive Resulting Stream In Same Page
I am trying to connect an e-commerce system to a payment gateway (located in Hong Kong). The gateway takes values in the form of a simple form submit - however, the results (i.e. authorisation code, status, etc...) are not returned to a separate HTML page (I am not given the option of defining a resulting HTML page to which the results are sent) - but rather I must receive them within the same page through a data stream somehow. Does anyone have an idea how this is done? The example code given by the clearing house is in JSP - so not much use to me. Actually that recommends I send the data through a stream too - but that seems more complicated than is necessary surely? So far, i've done : print "<form name="paydollar" method="POST" action="https://www.paydollar.com/b2c2/eng/payment/payForm.jsp">"; print "<input type="hidden" name="orderRef" value="$cus_no">"; print "<input type="hidden" name="amount" value="$finalp">"; print "<input type="hidden" name="currCode" value="344">"; print "<input type="hidden" name="lang" value="E">"; print "<input type="hidden" name="merchantId" value="xxxx">"; print "<input type="hidden" name="pMethod" value="$credit_type">"; print "<input type="hidden" name="epMonth" value="$credit_expmo">"; print "<input type="hidden" name="epYear" value="$credit_expyr">"; print "<input type="hidden" name="cardNo" value="$credit_no">"; print "<input type="hidden" name="cardHolder" value="$cc_holder">"; print "<input type="hidden" name="remark" value="">"; print "<input type="hidden" name="payType" value="H">"; print "</form>"; .... and within the <body> tag I have onLoad="paydollar.submit();" - so my form is successfull submitting automatically after the PHP script carries out a few other functions locally (i.e. store orders to the database). What stumps me is how to receive the resulting data from within the same page.
Supress Errors At The Page Level? Undefined Index Errors.
I'm creating a simple reply form, and if a form item isn't answered I get an error: "Notice: Undefined index: rb_amntspent in c:inetpubwwwrootmackinawsurvey.php on line 36" even if in the code I allow for an unselected item. (Code at the bottom here.) It works fine otherwise. Now in the past I've made a change to php.ini to repress errors, but for this project I don't have access to the php.ini. Is there a way to supress errors on that page for that session? Or, is there a way to just not get that error at all? Here's a sample of the code that gets the form response. If an item is selected, no error for that question, but if an item is not selected I get the error above even though I still get a successful echo for the "else" or "default" option which occurs if nothing is selected: $rb_visited = $_POST["rb_visited"]; //Have you ever visited Mackinaw City, Michigan? if ($rb_visited == "1") { $rb_visited_reply = "Yes"; } elseif ($rb_visited == "0") { $rb_visited_reply = "No"; } else { $rb_visited_reply = "You did not answer this question"; }; $rb_lastvisit = $_POST["rb_lastvisit"]; //When was your last visit to Mackinaw ity? switch ($rb_lastvisit) { case "1": $rb_lastvisit_reply = "Earlier this year (2003)"; break; case "2": $rb_lastvisit_reply = "Last year (2002)"; break; case "3": $rb_lastvisit_reply = "2 years ago (2001)"; break; case "4": $rb_lastvisit_reply = "3 years ago (2000)"; break; case "5": $rb_lastvisit_reply = "4 or more years ago (1999)"; break; default: $rb_lastvisit_reply = "You did not answer this uestion"; }
Displaying Errors
php_info(); for display_errors variable says: Off, Off. I tried the error_reporting(E_ALL);, but nothing happens. If I have an error somewhere, PHP just silently dies, no output whatsoever. Which variable has to be set so that error_reporting() function works, but no errors/warnings are displayed if the error_reporting() wasn't executed (admins don't want to have display_errors On globally)? PHP Version is 4.3.3. --
Eregi Is Not Displaying Errors?
the code below only display first occurance of false error message, infact i am sending both the email and password value in incorrect format of regexp. So it should display both the errors when the functions are called. Code:
Long Load Times With Link Validation
I am creating a webpage that has a bunch of my friends webcams and displays whether they active or not. The webcam software we use basically runs a webserver on our computers and can be accessed by going to http://<ip>:<port>. At first, I simply used the fopen function to determine if the page was active, however when I found that it took so long to work (It works, but takes about 1min-1.5mins to load) I downloaded a more complicated script from the internet that I don't quite understand at this point in my PHP career. Same result, works but takes forever. PHP Code:
Error Reporting And Displaying Errors
I've just switched to a dedicated server where php.ini has error_reporting all and display_errors off I need to see errors for debugging and when I try to set the local display_errors value to "1" or "ON" for a 1 page script that I know has errors, I still get no output. I know its being set, because i run phpinfo() right after setting it and the display_errors value changes to ON NOTE: When I change display_errors in php.ini, they show up on the page Code:
Submit Form Without Clicking Submit Button
I was wondering if it is possible to use something like Javascript to make it so you don't have to click the submit button on a form to make it submit, while using php and mysql. e.g. Code:
Using PHP To Load Another Page Or Html Page
Ive got a PHP script, which if it ends correctly, i want load another PHP file or an HTML page automatically, ie without user intervention. The new page shoud replace the current page on the browser. Is there a PHP command or function which does this?
Placing Errors On The Page
I have code below (due to length I only included a portion). I am validating an email address. It checks to see if the email field is blank, in the proper format, etc... It prints errors to the screen and everything works perfectly, but the errors always print at the very top of the page and I am having difficulty moving those errors around so they fit nicely into the page design I have. Rather than printing the errors I tried assigning them to variables and printing them elsewhere on the page, but it didn't work and the errors did not try at all. I also tried moving the function to a different part of the page where the errors would print where I wanted them, but I had the same problem as with the variables. I'm kind of in a bind and need this done asap. Does anyone have any thoughts on this? <?php function process_form() { global $db; $firstName = addslashes($_POST['firstName']); $lastName = addslashes($_POST['lastName']); $email = $_POST['email']; $emailHash = md5($email); $active = "n"; // Check syntax $validEmailExpr = "^[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$ %&_-])*" . "@[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])* $"; // Validate the email if (empty($email)) { print "The email field cannot be blank"; return false; } elseif (!eregi($validEmailExpr, $email)) { print "The email must be in the name@domain format."; return false; } elseif (strlen($email) 30) { print "The email address can be no longer than 30 characters."; return false; } elseif (function_exists("getmxrr") && function_exists("gethostbyname")) { // Extract the domain of the email address $maildomain = substr(strstr($email, '@'), 1); if (!(getmxrr($maildomain, $temp) || gethostbyname($maildomain) != $maildomain)) { print "The domain does not exist."; return false; } } $db->query('INSERT INTO users (firstName, lastName, email, hash, active) VALUES (?,?,?,?,?)', array($firstName, $lastName, $email, $emailHash, $active)); $message = " Thank you for signing up for the . Please click on the link below to confirm your registration. If the link is not active, copy-and- paste it into your browser window. http://www.EmailCapture/validateSuccess.php?id=$emailHash "; $subject = ""; $from = ""; mail("$email", "$subject", "$message", "From: $from"); print "<script>window.location=..
Displaying Parts Of A Page While The Page Is Not Complete Yet
A script I'm writing outputs a HTML table with many rows. Each row is the result of a query which takes about one minute to perform. When I run the script in a browser, the page takes several minutes to load and then displays the entire table. Is it possible (using PHP) to display the table as it gets constructed, one row at a time?
Errors Validating XHTML Page
I've been validating some pages as XHTML 1.0 using the W3C HTML Validation Service. (http://validator.w3.org/) I've come across 2 familiar snippets of PHP code that make it ack, and have had no luck resolving it! Code:
Page Load For IP
Is there any way only a certian IP address on our network can see a particular Table on the page? or if a certian ip Adress goes to our intranet page load a certain page depending on that IP address.
Incrementing On Page Load
I have one form that I want to send email. Instead of using multiple pages, I have condensed it to one. However, I don't know how to increment a value, say "display", each time the submit button is clicked. For instance - I have $display = "1". I want 1 to increment to 2, 3, and so on once the user clicks submit once, twice, etc. But I only want the "validation fields" to show after the user has clicked submit.
Set Time To Load A Page
I want to make a page which take time almost 60 seconds to load the contents....means a script in php which sleep for a 60 seconds and then execute the next part....
Page Load Frequency
I need a function to prevent a page from being loaded too often too fast. So say, one is only allowed to refresh a single page 5 times in 10 seconds, or 10 times in 5 seconds (or whatever ... ). If the load frequency exceeds that, the site calls exit(); And a message is displayed. Just like Expression Engine does ... This way i want to protect the DB from being queried rediculously often, and maybe even protect it from DDOS attacks. I hope it's clear. I don't know where to start ..
Redirect If Page Does Not Load
I have a form that will not submit if certain data cannot be found in Mysql or it will take very long to submit. Is there a way i can have the form go to an error page if it does not submit or load results in 5 seconds. If it does take long i need the following: $msg[] = $error10; header("Location: quote_error.php?");
Never Ending Page Load
When I run this script, it tries to load but after aout 10 minutes the whole browser locks up because it can't do it. I have a hunch it is because the while loop doesn't ever stop, but I don't know how to prevent it. Code:
Page Load Time
I have a php/html page that is taking longer to load then i think it should is there a way to see what part of the page is hanging it up?
Detecting 404 Aqnd Other Page Errors On A Remote Website
Is it possible to detect page errors such as 404 (page not found)? I've searched good but can't find anything, or i'm not looking in the right places. If so, would you be able to detect it even if a htaccess redirects it to an error page?
Re-populating A Form If Errors
I am learning php. I have created a simple Web page with a form. After receing the POST request, I do some error checking. In case of errors, I would like to re-post the page, but with the current values for each field. I have organized my files like this: 1) Webpage with the form (all in html, form action points to a php file) 2) php file that receives the request.
Can´t Load Page Before Refresh??
Why my pages don´t appear after linking to them (.php3), I have to Refresh the page and then it appears. And of course I loose the passed information from previous page??? This is REALLY bothering me A LOT. Please, does anyone know the answer???
Page Load Time + Iframe
There is any way to get the total load time of a page when you get an "IFRAME" on it? In all the tests, I got only the base page time without the "IFRAME" time.... <?php $bench = new phpCounter(); $bench->StartCouter(); $page = "<iframe class=......"; echo $page; $bench->EndCounter(); echo $bench->GetCounter(); ?> Where: // StartCounter() & EndCounter() call this function function SetCounter ( ) // {{{ { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } // }}} // Function to return the counter function GetCounter ( ) // {{{ { $output = ($this->end - $this->start); return substr($output, 0, 5); } // }}}
Set_error_handler: Page Does'nt Load
I've written a custom error handler and it works as it should on my development server(mac OS), but when I try to use it on the live server(freeBSD: PHP Version 4.0.1pl2) the pages that use set_error_handler("my_error_handler"); won't load. Is there some configuration setting that would prevent me from using a custom error handler?
Load Page In Middle Without Anchors
i am using php and have an "update.php" page that is a long list of input forms for an admin user to update database entries. each entry has its own "update" button. so when the user edits an entry and clicks "update" s/he is directed to a processing script which updates the database and returns the user to "update.php". heres my problem: the user is returned to the top of page (which is fairly long) so they have to scroll back down every time if they want to edit a number of subsequent entries. i would like the "update" submission to somehow save the current page view so that the user is returned to precisely the same scrolled down view as before. can this be done without anchors? i know i could use anchors but am i right that this would cause some scrolling up or down to the nearest anchor in general? i would prefer some way of doing it by percentage, pixels, etc so as to cause a sort of transparent departure and return to the page.
$_SERVER['argv'] Doesn't Have A Value On First Page Load.
when i first load index.php with arguments ie: "index.php?page=x", the $_SERVER['argv']value is null. I then get the session id appended to each link. If i refresh the page, I get the $_SERVER['argv'] I want, but if i click a link $_SERVER['argv'] returns the value I want and the session id. Any ideas as to how I can get the $_SERVER['argv'] to return the arguments on first page load?
INSERT Data On Page Load?
I have an avatar system where certain avatars are locked until the user unlocks them by going to certain pages of the site. So far ( being the newb I am ) I only know how to INSERT data from a form. Is there a way to do it on page load or similar? I also need it to first check if the data already exists and if not it inserts the data and then displays a message to the user that they have unlocked the avatar. Code:
Insert To Database On Page Load
I have the code for inserting data to a database form a form (Code below) but I want the data to be entered upon a page loading, how would I do this? Code:
Curl Load Page That Has Variable In Url?
I'm trying to load a page that has a variable in the url. Such as: index.php?name=bob I tried acting like the page was just a normal page (such as index.php) but that didn't seem to work. How do I give the server the variable in the url?
PHP Form Submission Data Errors
One of my variables "link1" that is storing a bunch of urls is having random lines being duplicated on form submission. I just recently swithed servers from a PHP 4.3.3 to a 4.2.2 version. This error has only started appearing on the new machine. The script worked fine on the old server and still does on the test server. Any ideas? I think it might have to do with the ini config. i am stumped. here is a link to my code.
Refresh The Page After Submit
Does anyone know how I can automatically refresh the page after the script is executed ( after user hits submit) and the database is updated, so that the line "The main office is now..." shows the new entry into the db? Thanks.
2 Submit Buttons On 1 Page
I have this code : <INPUT TYPE="Submit" VALUE="Change Password" name="ChangePasswd" TABINDEX=4> <INPUT TYPE="Submit" VALUE="Login" name="action" TABINDEX=3> Problem : When the enter is pressed, the first submit is executed. -> "Change Password". I want that when enter is pressed that the "Login" button is triggered. Is there a possibility to set the enter to "Login" without changing the the place of the buttons??? (if I put "Login" button before "Change Password"; Enter does the "Login", but this is no option)
Page Will Download After I Hit Submit.
I have a registration form that works well. It updates my DB and also sends the new member an email. The problem is that when the member fills out the registration form and hits enter the page does it's thing and then tries to download to the desktop. I get a download window alert that asks what I would like to do with "index.php". What can cause this?
Queries Causing Page To Load Slowly
I'm currently having trouble getting a looped query to display the results in as quick a time as possible. At the moment the query takes far to long...and that's if it executes at all. At the moment i have around 3000 movie titles in the DB. Can anyone suggest a way of populating the select box in a relatively quick manner? Here is the code: PHP Code:
Page Load Time Show Really High
im running PHP 5.2 on IIS 6 (Windows 2003 Server) and im getting a weird load time result when trying to display page load times on each page. e.g. Page generated in 1193387528.5501 seconds. this is my current code: <?php $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<p>Page generated in '.$total_time.' seconds.</p>'." "; ?> but i've tried 4 others which are all simular. Any idea as to why it's showing a false result as it's loading in unde 1 second (Dual Xeon 2.8 HT server and connecting over 100mb pipe (college campus)).
|