Why would i do this long coding in the second page "script.php" the
variables values is already available in "script.php" when i do a post or
get, if i use $_POST or $_GET to define a variable already available, that
seems like a lot of extra coding for no reason.
"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Piet" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi
> >
> > I am trying to find examples of how and where to use $_POST, $_GET etc.
I
> > searched a lot of places, but cant seem to find decent examples or a
> > tutorial or something.
>
> $_POST and $_GET are associative arrays containing the form data sent by a
> user to a page. Whether your user's submitted form data is in $_POST or
> $_GET depends on what method attribute you've specified in the <form> tag
in
> your HTML code. Take a look at the following HTML example:
>
> <form method="get" action="script.php">
>     <input type="text" name="firstName">
>     <input type="text" name="lastName">
>     <input type="submit">
> </form>
>
> Now in the file script.php you can access the submitted form values in the
> $_GET array, using the form field names as array keys. e.g:
>
> <?php
>     $firstName = $_GET['firstName'];
>     $lastName = $_GET['lastName'];
>     echo 'The user submitted the name'.$firstName.' '.$lastName;
> ?>
>
> If you had set the <form method="post"> in your HTML, then you could have
> accessed the form values from the $_POST array within PHP.
>
> Hope that helps,
>
> Al

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

Reply via email to