SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    canada
    Posts
    153
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    calling php problem

    Hello everybody,

    what this code does is checkes 2 field to verify if there empty or not..if not empty it hould call the test1.php but it's not doing this..

    any ideas why this is..

    PHP Code:
    if(isset($authbutton))
    {    if(empty(
    $useridfield) || empty($pwdfield))
          {    echo 
    "<script langauge='javascript1.2' type='text/javascript'>",
                 
    "alert('UserId and Password must be entered to authenticate your account' );</script>";      
          
          }
        else
            {
                    echo 
    "<a href='test1.php'>testing </a>";

            }


  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you write this in Javascript so that you are not making calls to the php script?

    But if you insist on doing it this way, I would write it like this:
    PHP Code:
    if(isset($authbutton))
    {
      if( !
    $useridfield || !$pwdfield )
      {
        echo 
    "<script langauge='javascript1.2' type='text/javascript'>
                alert('UserId and Password must be entered to authenticate your account' );
              </script>
              "
    ;
      }
      else
      {
        echo 
    "<a href="test1.php">testing </a>";
      }

    John

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    canada
    Posts
    153
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    the script works, its just that it wont move without clicking the test link.. i just want the script to move into test1.php insted of asking for a click..

    Quote Originally Posted by PHP John
    Why don't you write this in Javascript so that you are not making calls to the php script?

    But if you insist on doing it this way, I would write it like this:
    PHP Code:
    if(isset($authbutton))
    {
      if( !
    $useridfield || !$pwdfield )
      {
        echo 
    "<script langauge='javascript1.2' type='text/javascript'>
                alert('UserId and Password must be entered to authenticate your account' );
              </script>
              "
    ;
      }
      else
      {
        echo 
    "<a href="test1.php">testing </a>";
      }


  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, of course it won't redirect your user to the test1.php script. All you are doing is echoing a HTML LINK, which REQUIRES a user to click on it in order take them to that page.

    Now, if you want to do it automatically, you would do it this way:

    header( "Location: test1.php" );

    Be aware that you can have NOTHING going out to the browser before the "header" is executed.

    HTH
    John


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
  •