SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    cheshire
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    nothing happens on submit

    I have written a script which prompts for info if a $name variable has not been set. However, on setting the variable, the script is supposed to process itself, now it knows $name exists it should display a wellcome message and a link so I can send the info to another page.
    However, on pressing submit all that happens is the textboxes clear and there is no wellcome etc. Anyone know why?

    Here is the script:

    <HTML>
    <HEAD>
    <TITLE> Sample Page </TITLE>
    </HEAD>
    <BODY>
    PHP Code:
    <?php
     
    if ( isset($name) )
    {
    print(
    "<P><b><center>Wellcome: $name </center></b><br> This is the feedback part of the \'Humans As Organisms\' module.<P>\n");

    $name urlencode ($name);
    $name2 urlencode ($name2);

    print(
    "<P>Click here <A HREF= \"bestpassword3.php?name=$name&name2=$name2 \">link</A>\n");
    print(
    " to be taken to a page that will display your test results.</P>\n");
    }

    else
    {
    print(
    " <!-- No name has been provided, so we
     prompt the user for one. -->"
    );

    print(
    " <FORM ACTION = $PHP_SELF METHOD = POST><br>\n");
    print(
    " Please enter your first name: <INPUT TYPE = TEXT  NAME = \"firstname\"><br>\n");
    print(
    " Please enter your surname name: <INPUT TYPE = TEXT  NAME = \"surname\"><br>\n");
    print(
    " Please enter your userid: <INPUT TYPE = TEXT  NAME = \"id\"><br>\n");
    print(
    " Please enter your password: <INPUT TYPE = PASSWORD  NAME = \"password\"><br>\n");
    print(
    " <INPUT TYPE = SUBMIT VALUE = \"GO\">\n");
    $name=$firstname " " $surname;
    $name2=$id " " $password;
    print(
    " </FORM><br>\n");

    }
    ?>
    </body>
    </html>

  2. #2
    SitePoint Enthusiast smashway's Avatar
    Join Date
    Sep 2001
    Location
    Lausanne, Switzerland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try to check your <FORM ACTION = tag in the HTML source in your browser. Maybe your $PHP_SELF variable is empty or wrong. it happened to me , so I was forced to replace all the $PHP_SELFs with hard-coded page names (apache/php on Win)...
    Smash

    Check this thread and help me: click here!

  3. #3
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reason is you're not actually processing the form. You need to do this:

    PHP Code:
    <?php
     
    if ( isset($doit) )
    {
    /* these should actually be up here - down there
    they're doing nothing because you can't process the
    form client-side with PHP which is what you were
    trying to do */
    $name=$firstname " " $surname;
    $name2=$id " " $password;

    print(
    "<P><b><center>Wellcome: $name </center></b><br> This is the feedback part of the 'Humans As Organisms' module.<P>\n");

    $name urlencode ($name);
    $name2 urlencode ($name2);

    print(
    "<P>Click here <A HREF= \"bestpassword3.php?name=$name&name2=$name2 \">link</A>\n");
    print(
    " to be taken to a page that will display your test results.</P>\n");
    }

    else
    {
    print(
    " <!-- No name has been provided, so we
     prompt the user for one. -->"
    );

    print(
    " <form action='$PHP_SELF' method='post'><br>\n");
    print(
    " Please enter your first name: <input type='text' name=\"firstname\"><br>\n");
    print(
    " Please enter your surname name: <input type='text' name=\"surname\"><br>\n");
    print(
    " Please enter your userid: <input type='text' name=\"id\"><br>\n");
    print(
    " Please enter your password: <input type='password' name=\"password\"><br>\n");
    print(
    " <input type='submit' name='doit' value=\"GO\">\n");
    print(
    " </FORM><br>\n");

    }
    ?>
    Last edited by tubedogg; Sep 5, 2001 at 00:53.
    Kevin

  4. #4
    SitePoint Enthusiast smashway's Avatar
    Join Date
    Sep 2001
    Location
    Lausanne, Switzerland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dOH my previous post makes me look stupid
    Smash

    Check this thread and help me: click here!

  5. #5
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Delete it


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •