Code Comments
Programming Forum and web based access to our favorite programming groups.Dear All, I have a very complex form on a page which when submitted, posts all the variables to another page that processes and displays them in a list. I want the user then to be able to send theses details on to the *next* page thats 'mails' them to me. I can do this pretty well with a just a few form field entries, like so: <? echo '<a href="mail.php?item1=', urlencode($item1), '">'; ?> But with over 200 different form fields to be filled in, my URL soon becomes bigger than 1000 chars! So I guess I need to use the POST command to send the variables instead, right? I can see how the POST command works inside a form, but I can't seem to grasp how it's syntax works outside of a <form form>, if at all. Am I barking up the wrong tree here? If anyone can take even a few moments to offer advice I would be so grateful, cos I have been reading many, many tutorials and forum posts without quite getting the answers I would love to know all afternoon and evening! Thankyou! Steve
Post Follow-up to this message"Steve" <luckylucky200@hotmail.com> wrote in message news:e9ee7310929ef02e11b6035a1905aa99@ne ws.teranews.com... > Dear All, > > I have a very complex form on a page which when submitted, posts all the > variables to another page that processes and displays them in a list. I want > the user then to be able to send theses details on to the *next* page thats > 'mails' them to me. I can do this pretty well with a just a few form field > entries, like so: > > <? echo '<a href="mail.php?item1=', urlencode($item1), '">'; ?> > > But with over 200 different form fields to be filled in, my URL soon becomes > bigger than 1000 chars! So I guess I need to use the POST command to send > the variables instead, right? I can see how the POST command works inside a > form, but I can't seem to grasp how it's syntax works outside of a <form > form>, if at all. Am I barking up the wrong tree here? If anyone can take > even a few moments to offer advice I would be so grateful, cos I have been > reading many, many tutorials and forum posts without quite getting the > answers I would love to know all afternoon and evening! > > Thankyou! > > Steve > > I'de hate to fill out one of your forms ;-) They both submit a $querystring variable.GET or POST should not matter. The size limitations are well beyond what you are talking about. From a practical sense, POST probably makes more sense. What do you mean by "how it works syntax" ? Nothing should be different.
Post Follow-up to this messageif you set up a form and use post you dont need all that urlencode.. all you do in your form is have an email msg string and in the msg part use $_POST[variable] in each place you want each variable... "Steve" <luckylucky200@hotmail.com> wrote in message news:e9ee7310929ef02e11b6035a1905aa99@ne ws.teranews.com... > Dear All, > > I have a very complex form on a page which when submitted, posts all the > variables to another page that processes and displays them in a list. I want > the user then to be able to send theses details on to the *next* page thats > 'mails' them to me. I can do this pretty well with a just a few form field > entries, like so: > > <? echo '<a href="mail.php?item1=', urlencode($item1), '">'; ?> > > But with over 200 different form fields to be filled in, my URL soon becomes > bigger than 1000 chars! So I guess I need to use the POST command to send > the variables instead, right? I can see how the POST command works inside a > form, but I can't seem to grasp how it's syntax works outside of a <form > form>, if at all. Am I barking up the wrong tree here? If anyone can take > even a few moments to offer advice I would be so grateful, cos I have been > reading many, many tutorials and forum posts without quite getting the > answers I would love to know all afternoon and evening! > > Thankyou! > > Steve > >
Post Follow-up to this messageThanks for the replys! I guess I was tired and not explaining my situation very clearly last night. It's basically as simple as this: forget the whole forms thing. I have a page with 200 variables set up. I need to pass them on to another page. I thought that by going the way of tagging them onto the end of my URL would make it over 1000 characters and therefore not feasible. Am I right or wrong, there? If I'm right then I need to send them through the POST command I think, but I only see examples of how to use that in the context of a form, but thats no good to me at this stage as the form has already been filled and the variables set up. I simply need to pass a large amount of variables form page to page in a simple way. Sorry for being so obtuse before! Steve
Post Follow-up to this messageHi! Thanks for replying! You seem right about POST - I finally get it now! In fact it works just fine on the page immediately after my form is submitted, but when I paste the same command in to an HTML document which is *a couple of pages after* the form, it just returns no values at all, almost like it has forgotten them. Whats the problem here, do you think? Steve>
Post Follow-up to this message$_POST vars only carry over to the very next page, you would have to use an <input type="hidden" name="varName" value="$_POST[var]"> to use them on another form on another page... or perhaps you could start a session by using session_start(); at the top of each page and store all vars in the $_SESSION global var... this would be done by making a statement like this: $_SESSION[var] = "$_POST[var]"; this way as long as the session is active, no matter how many pages later.. the vars will still be there... "Steve" <luckylucky200@hotmail.com> wrote in message news:8a73d05a36e9d1fa09c0598f1c98676f@ne ws.teranews.com... > Hi! Thanks for replying! You seem right about POST - I finally get it now! > In fact it works just fine on the page immediately after my form is > submitted, but when I paste the same command in to an HTML document which is > *a couple of pages after* the form, it just returns no values at all, almost > like it has forgotten them. Whats the problem here, do you think? > > Steve> > >
Post Follow-up to this messageSteve wrote: > Dear All, > > I have a very complex form on a page which when submitted, posts all the > variables to another page that processes and displays them in a list. I > want the user then to be able to send theses details on to the *next* page > thats 'mails' them to me. If you want values to persist over several pages, it's probably easier to set up a temporary session to hold them. You can use the post trick that the others talked about, but at the top of the very next page, start a session and then put the variables in there. <? # This is the top of the first page to receive the variables session_start(); $_SESSION['var1'] = $_POST['var1']; # and so on for all of them. ?> I don't know of any way to just chuck all posted vars into a session with a single command, unfortunately. But if somebody wants to write a class to do this, I'd want a copy please :) OK, now you have a session. At the top of every page you want the vars to be available, you must call session_start() and you can then extract the vars using $_SESSION['var1'] to $_SESSION['var200plus']. Finally, when yo u don't need the session variables any more, call session_destroy(). You'll also find chocolate cake at this address: http://www.php.net/manual/en/ref.session.php Albe -- http://www.ninja.up.ac.za
Post Follow-up to this messageOn Fri, 26 Mar 2004 09:18:06 +0200, .:Ninja wrote:
> # This is the top of the first page to receive the variables
> session_start();
> $_SESSION['var1'] = $_POST['var1'];
> # and so on for all of them.
> I don't know of any way to just chuck all posted vars into a session with
> a single command, unfortunately. But if somebody wants to write a class to
> do this, I'd want a copy please :)
Off the top of my head, I think something like this would work:
foreach (array_keys ($_POST) as $key) { $_SESSION[$key] = $_POST
1;$key]; }
HTH,
La'ie Techie
Post Follow-up to this messagePOST can send bigger data than GET, something like 2 to 4 times more. Savut <Nikola Tesla> wrote in message news:Z-Sdnd-gWLsBgf_dRVn-tA@comcast.com... > > "Steve" <luckylucky200@hotmail.com> wrote in message > news:e9ee7310929ef02e11b6035a1905aa99@ne ws.teranews.com... > want > thats > becomes > a > > I'de hate to fill out one of your forms ;-) > > They both submit a $querystring variable.GET or POST should not matter. > The > size limitations are well beyond what you are talking about. > > From a practical sense, POST probably makes more sense. What do you mean > by > "how it works syntax" ? Nothing should be different. > > > > >
Post Follow-up to this messageOn Fri, 26 Mar 2004 16:17:43 -0500, "Savut" <webki@hotmail.com> wrote: >POST can send bigger data than GET, something like 2 to 4 times more. Er, I think you'll find it's considerably more than that. -- Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.