Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    TrainReq
    Guest

    Check to see if post

    What is the query to run to basically to see if a value was posted in "username" ... basicly here is what I need to do

    If ANY value is posted to Username ($_POST['username']) , dont do anything.... if there isnt a value posted to username header("location: http://google.com");

  • #2
    New Coder
    Join Date
    Jan 2007
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    if (!isset($_POST['username']))
     {
    header("location: http://google.com");
     }

  • #3
    TrainReq
    Guest
    hm... is that to make it header: location if there ISNT anything posted? because that is what I want to do... if there is something posted, dont do anything...

  • #4
    New Coder
    Join Date
    Jan 2007
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That will make it so that if nothing is posted to username it will go to that url.

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    If the input field is a type="text", it will be set to an empty string upon submission. An isset() test of this type of input field will always be TRUE.

    You should use the empty() test or test it against an empty string ""
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

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