RE: [PHP] Re: Function Not Accepting Variable Values From a Form
| From: | Rick Emery | Date: | Thu, 21 Mar 2002 17:12:22 +0000 |
| Subject: | RE: [PHP] Re: Function Not Accepting Variable Values From a Form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89549@lists.php.net to get a copy of this message | ||
you still need to declare the values as GLOBAL
-----Original Message-----
From: Dr. Shim [mailto:ultimatezzz@hotmail.com]
Sent: Thursday, March 21, 2002 11:12 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Function Not Accepting Variable Values From a Form
I will try $_POST[] first. I do that under the "value" parameter for each
form element?
<input type="text" name="author" value="<?php
$_POST['author'] ?>">
Right?
--------------------------------------------------------------
"Julio Nobrega Trabalhando" <inerte@hotmail.com> wrote in message
news:20020321170051.24286.qmail@pb1.pair.com...
Scope. Try to pass the values as the function reference (inside the ()),
'global' them, or use $_POST[''], from 4.1 and beyond.
If you don't know what's a 'scope', there's an entry on the manual that
can explain better.
--
Julio Nobrega.
Um dia eu chego lá:
http://sourceforge.net/projects/toca
Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
"Dr. Shim" <ultimatezzz@hotmail.com> wrote in message
news:20020321165405.14187.qmail@pb1.pair.com...
> Alas, more problems with forms =)
>
> Well now, here is my problem. I have a form, "method" is set to "post",
and
> action is set to the same page. I also have a hidden field named
> "form_post" and it's value is "1".
>
> Underneath this form is my PHP script.
>
> <?php
>
> if (isset($form_post))
> {
> echo "Function \"isset\" called. Values are...<br>\n
> Title: $title<br>\n
> Author: $author<br>\n
> Lead Actors: $actors<br>\n
> Poster: $poster<br>\n
> Summ.: $summery<br><br>\n\n
> Rev.: $review<br><br>\n\n";
> verify(); // Function call to verify
> } else {
> exit;
> } // Since form_post is set, it proceeds to verify. Strangley
enough,
> all the values appear in this if block.
>
>
> function verify()
> {
>
> echo "Verify called. Values are...<br>\n
> Title: $title<br>\n
> Author: $author<br>\n
> Lead Actors: $actors<br>\n
> Poster: $poster<br>\n
> Summ.: $summery<br><br>\n\n
> Rev.: $review<br><br>\n\n";
> }
>
> In the function "verify" no values appear, just:
>
> Title:
> Author:
> Lead Actors:
> Poster:
> Summ.:
>
> Rev.:
>
> Although -- as the comment said -- the if block shows all the values just
> fine.
>
>
> What could possibly be wrong? The solution to my last problem was to get
rid
> of any functions. However, that results in highly messy code! There has
got
> to be a way of having values passed to a function.
>
> Thanks for any help/suggestions.
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php