[FX.php List] Results of FMNew()
Bob Patin
bob at patin.com
Mon Dec 12 11:33:10 MST 2005
Andy,
That's an excellent solution; if I hadn't already finished it I'd do
it exactly that way. I never used includes with CDML, so they're
fairly new to me. I've used them a little now, but will need to start
thinking about them more often. Perfect solution!
Thanks,
Bob
On Dec 12, 2005, at 10:57 AM, andy at fmpug.com wrote:
> Hi Bob -
>
> The reason for the use of the $_REQUEST in this example was because
> I needed one page to serve two purposes. Firstly the information
> submitted via the web form was a $_POST action. I also wanted to
> test this manually without having to keep going back to the web
> form so I manually entered the variables in the web address, thus
> requiring a $_GET action.
>
> Just remember that $_REQUEST will process both actions and
> therefore is a valuable tool.
>
> Now, on your quandry of how to get the submitted data to appear in
> a third page. Instead of having a third page, you could
> conditionally display the data on the action or result page based
> on the value in the country field. To do this you will want to
> start looking at the use of includes in your php.
>
> Includes are invaluable in that they help you seperate out parts of
> your web pages into smaller more manageable pages. Also useful when
> you have information that is the same on all pages (such as a
> footer or navigation)
>
> So, take your resulting invoice page and take the code that makes
> the invoice and place that in its own php page called invoice.php.
> Do the same for the fax page callig it fax.php
>
> Now, on your result page for your web form, conditionally display
> the correct included file using an IF statement.
>
> <?php
>
> if ( $_POST['Country'] =="U.S." or $_POST['Country'] =="Canada") {
>
> include_once('invoice.php');
>
> } else {
>
> include_once('fax.php');
>
> }
>
> ?>
>
> Hope this helps
>
> Andy
>
>
> Hi Andy,
>
> Thanks so much for your great answer; that was exactly what I was
> wondering.
>
> So is there a general rule about which to use in different
> situations? I just started working with PHP about a month ago, and
> have used nothing but POST in the solutions I've done. Why did you
> use REQUEST in your example? I assume you had a good reason... :)
>
> On a slightly-related topic: I had a case the other day where the
> user POSTs some data; they go to a 2nd page where 1 of 2 things
> happens: if they live in the U.S. or Canada, an invoice shows; if
> they don't, I send them to a faxable page. To show the POST data on
> this faxable page, I wanted to grab the data they'd posted
> originally on page 1. The only way that I could think to move the
> data from page 1 (the SUBMIT page) to the 3rd page was to put the
> POST data into SESSION variables, and then retrieve it for creating
> the 3rd page.
>
> So here's the question: on page 2, I'd retrieved the SESSION data;
> is there a way to "store" these variables without using the SESSION
> variable, or was that the best method? When I went to the 3rd page,
> could I have retrieved these POST variables again? I assume they
> weren't retrievable on this 3rd page, am I correct?
>
> I hope this makes sense in my explanation!
>
> Bob
>
>
> On Dec 12, 2005, at 9:56 AM, andy at fmpug.com wrote:
>
> Hi Bob -
>
>
>
> $_REQUEST will accept values from either a $_GET or a $_POST.
>
>
>
> Always use $_POST if you want to be more secure, as the variable
> information is not returned to the visitor in the page address.
>
>
>
> The downside of using $_POST is that if your visitors refresh a
> page, they will receive a warning stating they need to resubmit the
> information. a $_GET will add the variables to the web address,
> thus allowing a refresh to happen without warnings.
>
>
>
> Hope this helps
>
>
>
> Andy Gaunt
>
> andy at fmpug.com
>
> http://www.fmpug.com
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20051212/46daa8f6/attachment-0001.html
More information about the FX.php_List
mailing list