Forums
This topic is locked
Forms over several pages...
Posted 25 Mar 2003 15:15:56
1
has voted
25 Mar 2003 15:15:56 Oli Wilkinson posted:
Hi Guys,I'm looking at making a form that covers several pages:
Page 1 is address details,
Page 2 is personal information,
Page 3 is....etc
bascially after each page there is a proceed to need section until the final page where there is a submit button. It is only then that an email is sent with all of the information.
So how do I do this?
Thanks in advance for any help! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replies
Replied 25 Mar 2003 16:30:05
25 Mar 2003 16:30:05 Iain Stewart replied:
Set up your forms as you would as usual with text boxes or areas, proceed buttons linking to the next page and so on.
noteing the names of your text boxes eg name box = name, address box = address etc
On the submit page create another form, all the info in the forms should be available in global variables eg address box info will be in variable $address , name info in variable $name ,
so when you proceed / submit the form it takes you to the next page and just pull all the info together on the last page were you want the mail function to work.
If your using php you may have to set global variables on in your php.ini file.
hope this helps you
Iain
head hurts, 'mental note to self, stop banging head !'
noteing the names of your text boxes eg name box = name, address box = address etc
On the submit page create another form, all the info in the forms should be available in global variables eg address box info will be in variable $address , name info in variable $name ,
so when you proceed / submit the form it takes you to the next page and just pull all the info together on the last page were you want the mail function to work.
If your using php you may have to set global variables on in your php.ini file.
hope this helps you
Iain
head hurts, 'mental note to self, stop banging head !'
Replied 25 Mar 2003 18:02:05
25 Mar 2003 18:02:05 Julio Taylor replied:
you can also use POST and GET vars to do this in HTML, without using PHP globals. use hidden forms at the end to gather all your bits and submit it to the script / database.
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Replied 26 Mar 2003 00:20:01
26 Mar 2003 00:20:01 Iain Stewart replied:
Cool, never thought of doing it that way, sometimes just stuck in scripting mode and never think there is an easy answer, theres hope yet <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Iain
head hurts, 'mental note to self, stop banging head !'
Iain
head hurts, 'mental note to self, stop banging head !'
Replied 26 Mar 2003 13:49:43
26 Mar 2003 13:49:43 Oli Wilkinson replied:
Thanks for the response guys!
So poolio, how would I go about doing this - I'm sure it's straight forward but I'm not very expereinced with forms...
Thanks in advance for any help! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
So poolio, how would I go about doing this - I'm sure it's straight forward but I'm not very expereinced with forms...
Thanks in advance for any help! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 26 Mar 2003 17:16:10
26 Mar 2003 17:16:10 Vince Baker replied:
Page one has a form with for example two fields:
Firstname
Surname
These two text fields sit in a form.
The form properties need to be changed to:
<form name="form1" action="nameofpage2" method="get"
On page two, have text fields for address1, 2 3, 4
Make sure there are two hidden fields in the form. These will receive the values entered in firstname and surname in page 1.
<input type="Hidden" Name="Firstame" value="<%=Request.Querystring("Firstname"%>">
and the same for the surname.
again, set the form to send to page 3 with the get method (get places the values in the url)
On the third page do the same but have hidden fields for the values from page 1 and page 2.
Then submit all the values from page 3 to the table.
Regards
Vince
Response.write("The best line of code you can ever use"
VBScript | ASP | HTML | SQL | Oracle | Hosting
Firstname
Surname
These two text fields sit in a form.
The form properties need to be changed to:
<form name="form1" action="nameofpage2" method="get"
On page two, have text fields for address1, 2 3, 4
Make sure there are two hidden fields in the form. These will receive the values entered in firstname and surname in page 1.
<input type="Hidden" Name="Firstame" value="<%=Request.Querystring("Firstname"%>">
and the same for the surname.
again, set the form to send to page 3 with the get method (get places the values in the url)
On the third page do the same but have hidden fields for the values from page 1 and page 2.
Then submit all the values from page 3 to the table.
Regards
Vince
Response.write("The best line of code you can ever use"
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 27 Mar 2003 09:39:00
27 Mar 2003 09:39:00 Oli Wilkinson replied:
Hi Guys,
I've tried using the GET method, but it all seems to fall apart before I get to my final submit page...not sure why but it doesn't seem stable (I'm having to use up to 40 hidden varaibles).
(I'm using a total of 5 pages and all works well until I link to my 5th page). Curiously, I've tried starting from my 4th page to see if too many hidden variables is the problem, but it still doesn't want to go to the 5th page. (I've tried linking to another page but I get the same error message that the page cannot be found with a / in the browser window).
So...in light of this, how do I do it the PHP way as first suggested?
Many Thanks in advance for any help!
<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Edited by - ofw on 27 Mar 2003 11:51:04
I've tried using the GET method, but it all seems to fall apart before I get to my final submit page...not sure why but it doesn't seem stable (I'm having to use up to 40 hidden varaibles).
(I'm using a total of 5 pages and all works well until I link to my 5th page). Curiously, I've tried starting from my 4th page to see if too many hidden variables is the problem, but it still doesn't want to go to the 5th page. (I've tried linking to another page but I get the same error message that the page cannot be found with a / in the browser window).
So...in light of this, how do I do it the PHP way as first suggested?
Many Thanks in advance for any help!
<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Edited by - ofw on 27 Mar 2003 11:51:04
Replied 27 Mar 2003 12:54:52
27 Mar 2003 12:54:52 Julio Taylor replied:
ofw,
i've used the GET system many times before - i think the problem may be somewhere in your 4th page.
KEEP TRYING <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
i've used the GET system many times before - i think the problem may be somewhere in your 4th page.
KEEP TRYING <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Replied 27 Mar 2003 13:38:18
27 Mar 2003 13:38:18 Oli Wilkinson replied:
Your right poolio - it seems to be working now - but any ideas of the best way to get it all onto an email?
I've tried using cgiemail - but all it shows is the:
<%=Request.Querystring(
instead of the field value from the previuos pages. e.g name (from the first page) simply comes up as "<%=Request.Querystring(".
Is there something better that may give me a bit more control over the email format?
Thanks again! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
P.S. - I've also noticed that my hidden fields show up as:
">
at the bottom of my form! I'm sure this isn't meant to happen!
Edited by - ofw on 27 Mar 2003 13:45:18
I've tried using cgiemail - but all it shows is the:
<%=Request.Querystring(
instead of the field value from the previuos pages. e.g name (from the first page) simply comes up as "<%=Request.Querystring(".
Is there something better that may give me a bit more control over the email format?
Thanks again! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
P.S. - I've also noticed that my hidden fields show up as:
">
at the bottom of my form! I'm sure this isn't meant to happen!
Edited by - ofw on 27 Mar 2003 13:45:18
Replied 27 Mar 2003 13:52:28
27 Mar 2003 13:52:28 Vince Baker replied:
I use aspmail and have done for the last few years....
Simple to use but you will need to have access to install a dll on your server. (Most hosts have the dll already installed nowdays if they support .net)
Search for it and you can get a stripped down free version that is perfectly adequate for most mailing needs.
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Simple to use but you will need to have access to install a dll on your server. (Most hosts have the dll already installed nowdays if they support .net)
Search for it and you can get a stripped down free version that is perfectly adequate for most mailing needs.
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 28 Mar 2003 15:02:57
28 Mar 2003 15:02:57 Oli Wilkinson replied:
Thanks for all your help guys - but I now know why I'm having trouble..
The Request.Query string looks as if it is an ASP thing - but I'm developing my pages in PHP. What is the equivelant string in PHP I would need to enter into my hdden field value in order to get the information from the previous pages?
Cheers <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
The Request.Query string looks as if it is an ASP thing - but I'm developing my pages in PHP. What is the equivelant string in PHP I would need to enter into my hdden field value in order to get the information from the previous pages?
Cheers <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 28 Mar 2003 15:25:47
28 Mar 2003 15:25:47 Iain Stewart replied:
Hi,
try <?php $HTTP_GET_VARS['firstname']; ?>
just change firstname for each piece of info that you want to access, that should work
hope that helps
Iain
head hurts, 'mental note to self, stop banging head !'
try <?php $HTTP_GET_VARS['firstname']; ?>
just change firstname for each piece of info that you want to access, that should work
hope that helps
Iain
head hurts, 'mental note to self, stop banging head !'
Replied 28 Mar 2003 17:05:53
28 Mar 2003 17:05:53 Oli Wilkinson replied:
Thanks for that - I'm on the right track now!
However, I can't seem to retrieve my field values from the previous pages?
Do I need to put the form fields in a hidden variable first before I move onto the next page? And if so...how do I go about it?
Currently I'm just using GET with a link to the next page when I submit my forms
Thanks Again! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Edited by - ofw on 28 Mar 2003 17:08:44
However, I can't seem to retrieve my field values from the previous pages?
Do I need to put the form fields in a hidden variable first before I move onto the next page? And if so...how do I go about it?
Currently I'm just using GET with a link to the next page when I submit my forms
Thanks Again! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Edited by - ofw on 28 Mar 2003 17:08:44
Replied 28 Mar 2003 22:09:33
28 Mar 2003 22:09:33 Dennis van Galen replied:
use POST, not GET, GET gives you LONG URL like:
page2.php?name=Dennis&lastName=van+Galen&Bday=14/08/1973
That will not work, request the posted elements into the hidden elements on the second page.
But I use sessions, skip the hassle of re-posting and at the end you just readout the session structure and insert / update it.
with kind regards,
Dennis van Galen
DMXzone Manager
FAQ, Tutorial and Extension Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
page2.php?name=Dennis&lastName=van+Galen&Bday=14/08/1973
That will not work, request the posted elements into the hidden elements on the second page.
But I use sessions, skip the hassle of re-posting and at the end you just readout the session structure and insert / update it.
with kind regards,
Dennis van Galen
DMXzone Manager
FAQ, Tutorial and Extension Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
Replied 29 Mar 2003 09:41:34
29 Mar 2003 09:41:34 Oli Wilkinson replied:
Thanks for that - I'll use POST...but how do I request the posted elements into the hidden elements on the second page?
Once again...Thanks in advance! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
P.S. I'm not being lazy - I'm also checking the web for all this stuff - but there's so much to try and get through! <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Edited by - ofw on 29 Mar 2003 09:49:59
Once again...Thanks in advance! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
P.S. I'm not being lazy - I'm also checking the web for all this stuff - but there's so much to try and get through! <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Edited by - ofw on 29 Mar 2003 09:49:59
Replied 29 Mar 2003 14:59:39
29 Mar 2003 14:59:39 Julio Taylor replied:
use the Phakt "keep existing URL" function.. it's used in the "go to related page"... this will go to the next page, keep the current URL variables and also send the new variables through.
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Replied 29 Mar 2003 15:12:01
29 Mar 2003 15:12:01 Iain Stewart replied:
Hi,
I'm not to sure how to use sessions for it, but have you tried what i said above, edit your php.ini, turn on global variables, you just change one value in the file in your windows folder
register_globals = Off
to
register_globals = ON
and on your last page just called the variable $Name $Address or what ever you called your html form elements, thats what i've used before and works fine for me, don't know if thats the best way to do it or not, or weither you should leave global variables off but give it a go.
hope this helps
Iain
head hurts, 'mental note to self, stop banging head !'
I'm not to sure how to use sessions for it, but have you tried what i said above, edit your php.ini, turn on global variables, you just change one value in the file in your windows folder
register_globals = Off
to
register_globals = ON
and on your last page just called the variable $Name $Address or what ever you called your html form elements, thats what i've used before and works fine for me, don't know if thats the best way to do it or not, or weither you should leave global variables off but give it a go.
hope this helps
Iain
head hurts, 'mental note to self, stop banging head !'
Replied 30 Mar 2003 21:14:36
30 Mar 2003 21:14:36 Oli Wilkinson replied:
Hi Iain,
My global variables are set to on in my php.ini file.
How do you get the info together on your last page? I'm trying $HTTP_GET_VARS as suggested - but I still dont sem to have retrieved my values from the previuos pages.
Are you using POST or GET with the previous pages and is ther any extra PHP code I should be using to get the variables transfered to the next page?
Thanks in advance! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
My global variables are set to on in my php.ini file.
How do you get the info together on your last page? I'm trying $HTTP_GET_VARS as suggested - but I still dont sem to have retrieved my values from the previuos pages.
Are you using POST or GET with the previous pages and is ther any extra PHP code I should be using to get the variables transfered to the next page?
Thanks in advance! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 30 Mar 2003 22:31:01
30 Mar 2003 22:31:01 Iain Stewart replied:
Hi,
the variables should be availble as normal
<php print $name ?> should give you what ever was filled out in the name form element. Each box in your form elements over your pages should be available as global varibles,these can be accessed as normal varibles on the page, use post for your form. What you may need to do is post the info into hidden fields on page 2 then all to page 3 etc and just pull it all together on the final page,
let me know if this helps
Iain
head hurts, 'mental note to self, stop banging head !'
the variables should be availble as normal
<php print $name ?> should give you what ever was filled out in the name form element. Each box in your form elements over your pages should be available as global varibles,these can be accessed as normal varibles on the page, use post for your form. What you may need to do is post the info into hidden fields on page 2 then all to page 3 etc and just pull it all together on the final page,
let me know if this helps
Iain
head hurts, 'mental note to self, stop banging head !'
Replied 31 Mar 2003 09:25:30
31 Mar 2003 09:25:30 Oli Wilkinson replied:
Thanks Iain.
When you bring all your info together on the last page - what method are you using? I'm trying $HTTP_GET_VARS but I still have no luck in retrieving my values.
There's a breakthrough just around the corner...I 'm sure of it! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thanks
Edited by - ofw on 31 Mar 2003 09:28:26
When you bring all your info together on the last page - what method are you using? I'm trying $HTTP_GET_VARS but I still have no luck in retrieving my values.
There's a breakthrough just around the corner...I 'm sure of it! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thanks
Edited by - ofw on 31 Mar 2003 09:28:26
Replied 31 Mar 2003 09:41:04
31 Mar 2003 09:41:04 Julio Taylor replied:
hey ofw:
should be something like:
<pre id=code><font face=courier size=2 id=code>
<input name="_name_" type="hidden" value="<?php echo $HTTP_GET_VARS['variable_name']; ?>">
</font id=code></pre id=code>
that will print the value of your variable into a hidden field. if you want to test if the values are getting carried accross, try this:
<pre id=code><font face=courier size=2 id=code>
<?php echo $HTTP_GET_VARS['variable_name']; ?>
</font id=code></pre id=code>
on some later versions of PHP you need to use $_GET instead of $HTTP_GET_VARS... what version of PHP are you using?
In earlier versions than 4.1.0, use $HTTP_GET_VARS.
further info:
www.php.net/manual/en/reserved.variables.php
www.php.net/manual/en/configuration.directives.php#ini.register-globals
let me know how it goes!
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Edited by - poolio on 31 Mar 2003 09:48:09
should be something like:
<pre id=code><font face=courier size=2 id=code>
<input name="_name_" type="hidden" value="<?php echo $HTTP_GET_VARS['variable_name']; ?>">
</font id=code></pre id=code>
that will print the value of your variable into a hidden field. if you want to test if the values are getting carried accross, try this:
<pre id=code><font face=courier size=2 id=code>
<?php echo $HTTP_GET_VARS['variable_name']; ?>
</font id=code></pre id=code>
on some later versions of PHP you need to use $_GET instead of $HTTP_GET_VARS... what version of PHP are you using?
In earlier versions than 4.1.0, use $HTTP_GET_VARS.
further info:
www.php.net/manual/en/reserved.variables.php
www.php.net/manual/en/configuration.directives.php#ini.register-globals
let me know how it goes!
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Edited by - poolio on 31 Mar 2003 09:48:09
Replied 31 Mar 2003 15:17:18
31 Mar 2003 15:17:18 Iain Stewart replied:
you should also be able to use
<input name="name" type="hidden" value="<?php print $name; ?>">
or what ever the html form element was called, when you submit the form on the first page it should take you to page 2 with the next form and hidden elements to recieve the info from the previous form etc.
to check that the info is being passed, on page two write
<?php print $name ; ?>
make sure the name text box on page 1 is called name, submit the form, action to page 2 and you should get the name printed out.
hope this helps you
Iain
head hurts, 'mental note to self, stop banging head !'
<input name="name" type="hidden" value="<?php print $name; ?>">
or what ever the html form element was called, when you submit the form on the first page it should take you to page 2 with the next form and hidden elements to recieve the info from the previous form etc.
to check that the info is being passed, on page two write
<?php print $name ; ?>
make sure the name text box on page 1 is called name, submit the form, action to page 2 and you should get the name printed out.
hope this helps you
Iain
head hurts, 'mental note to self, stop banging head !'
Replied 31 Mar 2003 17:03:08
31 Mar 2003 17:03:08 Oli Wilkinson replied:
Thanks guys! I've managed to get it all working using the print method!
Hopefully I can return the favour soon...<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Edited by - ofw on 31 Mar 2003 18:14:16
Hopefully I can return the favour soon...<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Edited by - ofw on 31 Mar 2003 18:14:16