<?php
// if customerId is passed in the query string
// then convert it to integer (removing non-numeric
characters) and
assign it to $customerId
// otherwise assign 0 to customerId
// ** Note: if customerId = Hsad or any other weird
characters it will
end up being 0
// ** Note: I am using a short hand if statement (http://
snippets.dzone.com/posts/show/76)
$customerId = isset( $_GET['customerId'] ) ? (int)
$_GET['customerId'] : 0;
// build your page link in a variable
$page2 = "index.php?page=2";
// if customerId is greater than 0 then add it to the $page2
url
if( $custemerId > 0 )
{
$page2 .= "&customerId=" .
$customerId;
}
// Hope this helps.
// btw you can also use sessions so you don't give away the
customerId
in the query string
?>
On May 20, 10:49 pm, fjm67 <fjmannar... yahoo.com> wrote:
> I would like to have a variable carried over from 1
page to another so
> the variable doesn't need to be entered by the user on
all of the
> other pages. How can I do this?
>
> An example would be a user that enters a customer
number on page 1
> which is than populated with data from a mysql database
for that
> specific customer.
>
> Clicking page 2 would carry that same customer number
ALONG with other
> fields for the second page from the database. Can
someone point me in
> the right direction please. Thanks. Frank
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysql googlegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribe googlegroups.com
For more options, visit this group at http://
groups.google.com/group/phpmysql?hl=en
-~----------~----~----~----~------~----~------~--~---
|