Re: [PHP] Forms PHP

2003-07-03 Thread Greg Wiley
On Wed, 02 Jul 2003 14:58:39 +0100, Greg Wiley [EMAIL PROTECTED] 
wrote:

On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie 
[EMAIL PROTECTED] wrote:

[snip]
By maintaining the POST (assuming you're using POST)variables and
calling them into the form values when reloaded. If you go to the second
page store the POST variables in hidden form input types, then grab them
when the second page is POSTED. Does this make sense? Not enough
caffeine for me yet...[/snip]
So basically I need to have 2 versions of the first page, is that right?
:)

No, in your first form you have code like

Well almost. I realised whilst trying to get to sleep last night that 
there's a problem with this. In the first form you need:

?php
if ((!isset($_POST)) || (!isset($_POST['foo']))) {
$foo = set default value here;
	$action = form2.php;
} else {
$foo = $_POST['foo'];
	$action = results.php;
}
?
form method=post action=?php echo $action;?
input type=text name=foo value=?php echo $foo;? /
...
/form
This way you won't get a circular dependency. However, it means that you'll 
need to provide some other way of amending the details on form2 if it's a 
requirement.

and in the second form you have:

form method=post action=form1.php
input type=hidden name=foo value=?php echo $_POST['foo'];? /
...
/form
Cheers, Greg.
--
Greg Wiley
www.wileysworld.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Forms PHP

2003-07-02 Thread Jay Blanchard
[snip] 
I have a form that gets filled out and within this form there is a link
to add additional information in a new form. When this information is
saved I would like the browser to redirect to the previous form (this I
can do) but with all the details they have already filled out still in
the text boxes. What is the easiest way to do this using PHP?
 [/snip]


By maintaining the POST (assuming you're using POST)variables and
calling them into the form values when reloaded. If you go to the second
page store the POST variables in hidden form input types, then grab them
when the second page is POSTED. Does this make sense? Not enough
caffeine for me yet...

Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP

2003-07-02 Thread Gary Ogilvie
[snip]
By maintaining the POST (assuming you're using POST)variables and
calling them into the form values when reloaded. If you go to the second
page store the POST variables in hidden form input types, then grab them
when the second page is POSTED. Does this make sense? Not enough
caffeine for me yet...[/snip]

So basically I need to have 2 versions of the first page, is that right?
:)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP

2003-07-02 Thread Jay Blanchard
[snip]
By maintaining the POST (assuming you're using POST)variables and
calling them into the form values when reloaded. If you go to the second
page store the POST variables in hidden form input types, then grab them
when the second page is POSTED. Does this make sense? Not enough
caffeine for me yet...[/snip]

So basically I need to have 2 versions of the first page, is that right?
:)
[/snip]

Not really, test for emptiness of the variable (isset())...if it is set
display it, if not show it as blank.

HTH!

Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP[Scanned]

2003-07-02 Thread Michael Egan
If I've understood your initial email correctly another approach would be to save the 
contents of the form to your database and populate the form fields presented 
subsequently with information retrieved from the database.

You can use the header function to redirect to whatever page you wish once the 
information has been saved.

Regards,

Michael Egan



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP

2003-07-02 Thread Gary Ogilvie

[snip]
Not really, test for emptiness of the variable (isset())...if it is set
display it, if not show it as blank.

HTH!

Jay
[/snip]

You'll have to forgive me as I am unfamiliar with PHP, still a
beginner!! So if I have a page (page1.php) which is my first page with a
form. When I click a normal link within this form it takes me to
page2.php. This page has another smaller form. When the submit button in
this form is clicked it updates the database with no problems and
displays a link - linking back to page1.php (I have decided not to use
redirect). How do load the page and fill all the text boxes with the
information that was already written - because this information (from
page1.php, first form) has not been saved to the database yet.

You probably knew this anyway - but I had to go through that process to
satisfy myself!!

Many Thanks

Gary Ogilvie


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP[Scanned]

2003-07-02 Thread Gary Ogilvie

Wouldn't I then be saving the contents of that page twice in the
database?

-Original Message-
From: Michael Egan [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2003 14:53
To: PHP General
Subject: RE: [PHP] Forms  PHP[Scanned]

If I've understood your initial email correctly another approach would
be to save the contents of the form to your database and populate the
form fields presented subsequently with information retrieved from the
database.

You can use the header function to redirect to whatever page you wish
once the information has been saved.

Regards,

Michael Egan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Forms PHP

2003-07-02 Thread Greg Wiley
On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie [EMAIL PROTECTED] 
wrote:

[snip]
By maintaining the POST (assuming you're using POST)variables and
calling them into the form values when reloaded. If you go to the second
page store the POST variables in hidden form input types, then grab them
when the second page is POSTED. Does this make sense? Not enough
caffeine for me yet...[/snip]
So basically I need to have 2 versions of the first page, is that right?
:)

No, in your first form you have code like

?php
 if ((!isset($_POST)) || (!isset($_POST['foo']))) {
$foo = set default value here;
 } else {
$foo = $_POST['foo'];
 }
?
form method=post action=form2.php
 input type=text name=foo value=?php echo $foo;? /
 ...
/form
and in the second form you have:

form method=post action=form1.php
 input type=hidden name=foo value=?php echo $_POST['foo'];? /
 ...
/form
Cheers, Greg.
--
Greg Wiley
www.wileysworld.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Forms PHP

2003-07-02 Thread Gary Ogilvie

Ah I understand that - many thanks.

-Original Message-
From: Greg Wiley [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2003 14:59
To: Gary Ogilvie; 'PHP General'
Subject: Re: [PHP] Forms  PHP

On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie
[EMAIL PROTECTED] 
wrote:

 [snip]
 By maintaining the POST (assuming you're using POST)variables and
 calling them into the form values when reloaded. If you go to the
second
 page store the POST variables in hidden form input types, then grab
them
 when the second page is POSTED. Does this make sense? Not enough
 caffeine for me yet...[/snip]

 So basically I need to have 2 versions of the first page, is that
right?
 :)


No, in your first form you have code like

?php
  if ((!isset($_POST)) || (!isset($_POST['foo']))) {
$foo = set default value here;
  } else {
$foo = $_POST['foo'];
  }
?

form method=post action=form2.php
  input type=text name=foo value=?php echo $foo;? /
  ...
/form

and in the second form you have:

form method=post action=form1.php
  input type=hidden name=foo value=?php echo $_POST['foo'];? /
  ...
/form

Cheers, Greg.
-- 
Greg Wiley
www.wileysworld.org


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP

2003-07-02 Thread Jay Blanchard
[snip]
You'll have to forgive me as I am unfamiliar with PHP, still a
beginner!! So if I have a page (page1.php) which is my first page with a
form. When I click a normal link within this form it takes me to
page2.php. This page has another smaller form. When the submit button in
this form is clicked it updates the database with no problems and
displays a link - linking back to page1.php (I have decided not to use
redirect). How do load the page and fill all the text boxes with the
information that was already written - because this information (from
page1.php, first form) has not been saved to the database yet.

You probably knew this anyway - but I had to go through that process to
satisfy myself!!
[/snip]

If you are just clicking on a link instead of submitting the information
you have not populated any variables...so no recall is available unless
the clicked link is formatted to hold the variables (a GET). For
instance

a href = someotherpage.php?name=GaryClick Here/a

$_GET['name'] is equal to Gary

You can do it for more than one variable...

a href = someotherpage.php?name=Garyaddress=ChicagoClick Here/a

$_GET['name'] is equal to Gary
$_GET['address'] is equal to Chicago


HTH!

Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Forms PHP - Thanks

2003-07-02 Thread Gary Ogilvie
Thanks all,

I shall try these methods now. I may be a while - the form is pretty
large :)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] forms PHP

2001-12-06 Thread Richard S. Crawford

I've done something similar like this:

  a href=javascript:window.back() Click here to go back /a 

In the situations in which I've used it, the form data from the previous 
page is still in the form fields.

Potential downsides of this approach: the data has not yet been 
processed.  Or, if it has been, you run the risk of processing it 
twice.  Also, it may be unreliable depending on how the user's cache is set 
up (though I've never had any problems reported to me).

So, it may or may not suit your needs.


At 09:44 AM 12/6/2001, [EMAIL PROTECTED] wrote:
I think I'm making this harder or more confusing than it really needs to be.

I have a form that is spread out over four pages.  I want to be able to give
the user the opportunity to return to page 1 from page 3, for example, by
providing a regular link on page 3 to return to page1.  When they click on
this link, I want the info. originally entered in page 1 to still be there.

Do I need to use sessions to do this or is there another way?

Thank you, Shawna

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

It is only with the heart that we see rightly; what is essential is 
invisible to the eye.  --Antoine de Saint Exupéry

Push the button, Max!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] forms PHP

2001-12-06 Thread Dan McCullough

In some browsers that is what will happen on a form, is that will process the 
infromation twice.
--- Richard S. Crawford [EMAIL PROTECTED] wrote:
 I've done something similar like this:
 
   a href=javascript:window.back() Click here to go back /a 
 
 In the situations in which I've used it, the form data from the previous 
 page is still in the form fields.
 
 Potential downsides of this approach: the data has not yet been 
 processed.  Or, if it has been, you run the risk of processing it 
 twice.  Also, it may be unreliable depending on how the user's cache is set 
 up (though I've never had any problems reported to me).
 
 So, it may or may not suit your needs.
 
 
 At 09:44 AM 12/6/2001, [EMAIL PROTECTED] wrote:
 I think I'm making this harder or more confusing than it really needs to be.
 
 I have a form that is spread out over four pages.  I want to be able to give
 the user the opportunity to return to page 1 from page 3, for example, by
 providing a regular link on page 3 to return to page1.  When they click on
 this link, I want the info. originally entered in page 1 to still be there.
 
 Do I need to use sessions to do this or is there another way?
 
 Thank you, Shawna
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 Sliante,
 Richard S. Crawford
 
 http://www.mossroot.com
 AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
 MSN: [EMAIL PROTECTED]
 
 It is only with the heart that we see rightly; what is essential is 
 invisible to the eye.  --Antoine de Saint Exupéry
 
 Push the button, Max!
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


=
dan mccullough

Theres no such thing as a problem unless the servers are on fire!


__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]