In addition, it's worth of note that whenever something has a name attribute
it that will show up as a variable in your script. More or less.

One question though. Why does your <form> have a name attribute at all? And
naming it the same as a variable, for whatever reason, isn't a good idea if
for no other reason than it's confusing. It got a weird look from me...not
that that makes it very unusual...


--
Plutarck
Should be working on something...
...but forgot what it was.

"Rene Maldonado" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi I think it woulf be better this way:
>
>         print "<form action = '$PHP_SELF?action=1' method = 'post'
name
> = 'hello'>";
>         print "<input type='text' name='var_hello'>";
>         print "<input type  = submit value = 'Submit' >";
>
>
> and, the var name is $var_hello
>
> this way, the value of your var do not appear in the URL,
>
> This work for me...
>
>
>
> Martin Cameron wrote:
>
> > Here is a simple form file that needs to pass a variable - $hello - from
> > the form to a new function. Unfortunately, it doesn't.  When you click
> > the submit button, the URL looks like this:
> >
> >      http://localhost/test5.php?action=1&hello=
> >
> >      It should have the variable there after the "hello="
> >
> > I suspect it's something to do with parent.location. Looking for a
> > solution. Here's the script:
> >
> >      <head>
> >      </head>
> >      <body bgcolor=white>
> >      <?
> >      define(INITIAL_PAGE,0);
> >      define(SELECT,1);
> >      function initial_page(){
> >         global $PHP_SELF,$hello;
> >         print "<form action = '$PHP_SELF?action=1' method = 'post'
> >      name = 'hello'>";
> >         print "<input type='text' name='hello'>";
> >         print "<input name = 'hello' type='button' value='Submit'
> >      onClick=\"parent.location='$PHP_SELF?action=1&hello=$hello'\">";
> >
> >         print "</form>";
> >      }
> >
> >      function select(){
> >         global $hello;
> >         print "Hellooooooooooo, $hello!";
> >      }
> >
> >      initial_page();
> >
> >      switch($action){
> >       case INITIAL_PAGE:
> >         initial_page;
> >         break;
> >       case SELECT:
> >         select();
> >         break;
> >       default:
> >         die ("Hello, can't find that function.");
> >      }
> >      ?>
> >      </body>
> >      </html>
> >
> > The thing is that if you simply hit "enter" - rather than click the
> > "submit" button, the first directive in the <form> tag is invoked, and
> > the value of the $hello variable IS passed.
> >
> > regards
> > Martin Cameron
>


----------------------------------------------------------------------------
----


> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to