|
Posted by sathyashrayan on 03/23/07 17:13
On Mar 23, 9:28 pm, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spamyourself.com> wrote:
> sathyashrayan wrote:
> > Dear group,
> > My question may be novice. I have seen codes where the isset() is
> > used to test weather a user's session ($_SESSION[]) is set before
> > entering a page. A kind of direct access to a page is not possible.
> > But I tested with the "input type="button" and the clicking of the
> > event is not happened. Can any one tell me why. The code:
>
> > <html>
> > <body>
>
> > <form name='noname' action='test.php' method=post>
> > <input type="button" name='button' value='button'>
> > </form>
>
> > </body>
> > </html>
>
> > <?php
>
> > if(isset($_REQUEST['button']))
> > {
> > echo "clicked";
> > }
>
> > ?>
>
> > If I change the <input type='submit'> then it works, like get
> > submitted and perform the action. But why not with button?
>
> Hi,
>
> <Input type="button"> is just a HTML element.
> PHP is NOT involved what the receiving browser does with the HTML received.
>
> However, if you press a submit-button, you are posting a form to some
> script, in this case PHP.
>
> Keep a sharp eye on what client-server actually is if you want to learn PHP.
> WHAT happens at the server?
> WHAT happens at the client (browser)?
>
> In short: PHP produces output. That output goes to the browser. Browser
> displays it.
> If the HTML send to the browser happens to contain a form, then nothing
> special happens: it just displays the form.
>
> However, if you submit the form, your browser sends the information
> contained in the form to the receiving script.
>
> PHP can see what is posted by examining:
> $_POST[] superglobal for forms with method="POST".
> and
> $_GET[] retrieves all name/value pairs from the URL.
>
> eg, if you make a page with a form that contains:
> <input type="text" name="familyname">
> and that is posted to PHP (actiontag in the form), then PHP can retrieve
> that value via:
> $passedFamilyName = $_GET["familyname"];
>
> About the isset(): If you are not sure the form send to PHP contains an
> element with the name familyname, you can use isset to test this.
> if (isset($_GET["familyname"])){
> // code for existence of familyname
>
> } else {
> // no familyname
> }
>
> Hope that helps.
>
Yes helped a lot. Thanks..
[Back to original message]
|