Good evening Alex,Nothing is available to PHP until the form has been submitted. E.g. $_POST['example'] will always be empty if nothing has ever been posted to the script. This does not mean that you cannot check to see if that name exists, but it will not have been set unless a form was posted with an element with the name "example".
HTH, Everett----- Original Message ----- From: "Alex Hall" <mehgcap@xxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Thursday, December 11, 2008 7:58 PM Subject: Re: changing html page with reload
Oh, so the name attribute is always available to php, but the value attribute is only available after the first submission?Have a great day, Alex----- Original Message ----- From: "E.J. Zufelt" <everett@xxxxxxxxx To: <programmingblind@xxxxxxxxxxxxx Date sent: Thu, 11 Dec 2008 18:54:24 -0400 Subject: Re: changing html page with reloadGood evening Alex,If the button is pressed then the value will be submitted, if thebutton hasnot been pressed (first load of the page) no value will be set.See belowfor an example, you will want to do better validation on$_POST['btnSubmit']but you should get the just of it.HTML:<input type="submit" name="btnSubmit" value="Send Message" /PHP:if ($_POST['btnSubmit'] == "Send Message") { $submitted = true; }HTH, Everett----- Original Message ----- From: "Alex Hall" <mehgcap@xxxxxxx To: <programmingblind@xxxxxxxxxxxxx Sent: Thursday, December 11, 2008 7:49 PM Subject: Re: changing html page with reloadOh. The value is just a static word or phrase, though, so howcan it tellme if the form has been submitted or not?Have a great day, Alex----- Original Message ----- From: "E.J. Zufelt" <everett@xxxxxxxxx To: <programmingblind@xxxxxxxxxxxxx Date sent: Thu, 11 Dec 2008 18:39:19 -0400 Subject: Re: changing html page with reloadGood evening Alex,$submitted isn't a reserved variable. It was just an example ofwhat youcan do to get things working. You will have to do your own checkto see ifthe form has been submitted. Normally by checking the value ofthe submitbutton on the form.HTH, Everett----- Original Message ----- From: "Alex Hall" <mehgcap@xxxxxxx To: <programmingblind@xxxxxxxxxxxxx Sent: Thursday, December 11, 2008 7:35 PM Subject: Re: changing html page with reloadThanks. I did not know that $submitted was a reserved variable,but thatshould do the trick.Have a great day, Alex----- Original Message ----- From: "E.J. Zufelt" <everett@xxxxxxxxx To: <programmingblind@xxxxxxxxxxxxx Date sent: Thu, 11 Dec 2008 18:25:38 -0400 Subject: Re: changing html page with reloadGood evening Alex,You will need to dynamically generate the form on your server.1. Has the form been submitted: $submitted = true or false2. If the form has been submitted validate all of the input,perhaps use anarray for each form field to store a value of true / false foreach field.$fields['email'] = true if valid, false if invalid.3. Produce the form:if (submitted == true && $fields['email'] == false) { echo "Please enter a valid e-mail address"; } echo '<input type="text" name="email" />';This way the remark will only appear if the form has beensubmitted at leastonce and the value for that field is invalid.HTH, Everett----- Original Message ----- From: "Alex Hall" <mehgcap@xxxxxxx To: <programmingblind@xxxxxxxxxxxxx Sent: Thursday, December 11, 2008 7:06 PM Subject: changing html page with reloadI want to be able to put additional information in an html pageafter theuser submits a form. Here is an example: You fill out the form, submit it, and are taken to the phpprocessing theform. You typed your email address with no @ sign, though, sothe phpredirects you back to the form page (html). However, now thereis asentence above the "email" field that says something like: "Youdid nottype your email address correctly, please try again." I haveseen thisbefore; how is it done? I cannot use dynamic html because thetargetdevices, braillenotes, do not support it or AJAX. Does anyoneknow howthis is done? Thanks for any help.Have a great day, Alex __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind