Re: changing html page with reload

  • From: "E.J. Zufelt" <everett@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 11 Dec 2008 18:54:24 -0400

Good evening Alex,

If the button is pressed then the value will be submitted, if the button has not been pressed (first load of the page) no value will be set. See below for 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 reload


Oh. The value is just a static word or phrase, though, so how can it tell me 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 reload

Good evening Alex,

$submitted isn't a reserved variable.  It was just an example of
what you
can do to get things working.  You will have to do your own check
to see if
the form has been submitted.  Normally by checking the value of
the submit
button 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 reload


Thanks.  I did not know that $submitted was a reserved variable,
but that
should 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 reload

Good evening Alex,

You will need to dynamically generate the form on your server.

1.  Has the form been submitted: $submitted = true or false

2.  If the form has been submitted validate all of the input,
perhaps use an
array for each form field to store a value of true / false for
each 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 been
submitted at least
once 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 reload


I want to be able to put additional information in an html page
after the
user submits a form.  Here is an example:
You fill out the form, submit it, and are taken to the php
processing the
form.  You typed your email address with no @ sign, though, so
the php
redirects you back to the form page (html).  However, now there
is a
sentence above the "email" field that says something like: "You
did not
type your email address correctly, please try again." I have
seen this
before; how is it done? I cannot use dynamic html because the
target
devices, braillenotes, do not support it or AJAX.  Does anyone
know how
this 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

Other related posts: