SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need Help ! if there is no veriable then how to show an error message

    my code is
    <?php echo $_GET['abc']; ?>

    then it would be something like this

    ?abc=436346

    but if there is nothing in veriable i mean if ?abc=empty

    then how we can show this message

    " please put valid value for abc"

    Urgrnt PLease Help

  2. #2
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by bitz View Post
    my code is
    <?php echo $_GET['abc']; ?>

    then it would be something like this

    ?abc=436346

    but if there is nothing in veriable i mean if ?abc=empty

    then how we can show this message

    " please put valid value for abc"

    Urgrnt PLease Help

    Try this:

    PHP Code:
      echo isset($_GET['abc']) ? $_GET['abc'] : 'please put valid value for abc';

      
    // OR 

      // SET DEFAULT VALUE
      
    $result 'please put valid value for abc';

      
    // TEST  
      
    if(isset($_GET['abc'])) 
      {
         
    $result $_GET['abc'];
      }
      echo 
    $result

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i try this but does'nt work
    i am using an iframe ,
    here
    http://utguyiui.webatu.com/ns.php
    and when i try to access veriable for iframe
    http://utguyiui.webatu.com/ns.php?abc=4363437

    it'work but
    when there is no veriable
    it show me iframe here @ http://utguyiui.webatu.com/ns.php

    but i want to display only an error message

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by bitz View Post
    i try this but does'nt work
    i am using an iframe ,
    here
    http://utguyiui.webatu.com/ns.php
    and when i try to access veriable for iframe
    http://utguyiui.webatu.com/ns.php?abc=4363437
    Display all the items in $_GET then test for an exact match, etc

    PHP Code:

    echo '<pre>';
    print_r($_GET);
    echo 
    '</pre>'
    Last edited by John_Betong; Apr 3, 2013 at 01:09. Reason: missing /

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    don't understand that

  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how we can write all items in $_get

    please write this correctly for me

    i am showing my full code

  7. #7
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is i am using

    <iframe frameborder="0" width="480" height="272" src="http://www.dailymotion.com/embed/video/<?php echo $_GET[abc]; echo isset($_GET['abc']) ? $_GET['abc'] : 'please put valid value for abc';

    ?></iframe>

    when there is no veriable @ <iframe frameborder="0" width="480" height="272" src="http://www.dailymotion.com/embed/video/veriable

    then only show error message no iframe with message

    you can see when use http://utguyiui.webatu.com/ns.php?abc= (empty)

    iframe is showing and no error message
    Plesae

  8. #8
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by bitz View Post
    this is i am using

    <iframe frameborder="0" width="480" height="272" src="http://www.dailymotion.com/embed/video/<?php echo $_GET[abc]; echo isset($_GET['abc']) ? $_GET['abc'] : 'please put valid value for abc';

    ?></iframe>

    when there is no veriable @ <iframe frameborder="0" width="480" height="272" src="http://www.dailymotion.com/embed/video/veriable

    then only show error message no iframe with message

    you can see when use http://utguyiui.webatu.com/ns.php?abc= (empty)

    iframe is showing and no error message
    Plesae

    You are missing quotation marks around 'abc'
    Php thinks ABC is an undefined constant.
    Last edited by John_Betong; Apr 3, 2013 at 01:54. Reason: Constant ABC should be abc but editor not playing nicely :(

  9. #9
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but its still showing iframe not displaying error message
    chk this
    http://utguyiui.webatu.com/ns.php?abc=

  10. #10
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Try removing the first $_GET[ABC] from your link.

    [php]

    <iframe frameborder="0" width="480" height="272" src="http://www.dailymotion.com/embed/video/<?php echo isset($_GET['abc']) ? $_GET['abc'] : 'please put valid value for abc';

    ?></iframe>
    Last edited by John_Betong; Apr 3, 2013 at 02:01. Reason: cut & pasted new link

  11. #11
    SitePoint Enthusiast
    Join Date
    Mar 2013
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doesn't work

  12. #12
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by bitz View Post
    doesn't work
    Back on my desktop...

    Try this:

    http://johns-jokes.com/downloads/sp-b/bitz/


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
  •