1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

simple echo

Discussion in 'PHP' started by rigas, Jan 8, 2010.

  1. #1
    do you have any ideas why the code below or any other code i tried can not run at any browser. i get a blank page

    
    
    <?php
    $my_string = "Hello Bob.  My name is: ";
    echo "Hi, I'm Bob.  Who are you? $my_string Bobetta";
    ?>
    
    
    PHP:
    excuse me if it is a stupid question but i m new at php programming. thank you for your time
     
    rigas, Jan 8, 2010 IP
  2. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Please try this

    echo "Hi, I'm Bob.  Who are you? " . $my_string . " Bobetta";
    Code (markup):
     
    theapparatus, Jan 8, 2010 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    If u want to troubleshoot blank pages best thing to do is add this at the top

    <?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    ?>
     
    Bohra, Jan 8, 2010 IP
  4. rigas

    rigas Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    no change. blank page again.

    no error was diplayed but the output is blank page again
     
    rigas, Jan 8, 2010 IP
  5. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #5
    does echo $my_string; Work ??
     
    Bohra, Jan 8, 2010 IP
  6. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sounds like it might be an apache issue. Consider contacting your host. I've had this before, and it's due to Apache not having the correct permissions to view the file
     
    JAY6390, Jan 8, 2010 IP
  7. PRIMMY

    PRIMMY Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I do not find any error in the code, I think this is another issue.
     
    PRIMMY, Jan 8, 2010 IP
  8. insert

    insert Peon

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    do you have apache and php installed? do you have the file with php code in you localhost?
     
    insert, Jan 9, 2010 IP
  9. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #9
    perhaps create a file called phpinfo.php:

    and add this snippet:

    <?php
    
    phpinfo();
    
    ?>
    PHP:

    Then reply with the a link to its location (on your site), so it'll help us identify what could possibly be going wrong.
     
    danx10, Jan 9, 2010 IP
  10. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #10
    Is it possible that your putting the above code or any other code into a html file like index.html whereas it should be .php index.php ?
     
    MyVodaFone, Jan 9, 2010 IP
  11. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If it was a html page it would show the php code in its raw format
     
    JAY6390, Jan 9, 2010 IP
  12. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #12
    Are you sure about that :)
     
    MyVodaFone, Jan 9, 2010 IP
  13. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #13
    make a html file, put
    <?php echo 'hello'; ?> in it and then open the file in your browser
    Check the source, I bet it is there
     
    JAY6390, Jan 9, 2010 IP
  14. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #14

    Ahh the source is there, but its just a blank page otherwise ?

    I only said it as the OP has tried different php scripts, all with the same result " a blank page "
     
    MyVodaFone, Jan 9, 2010 IP
  15. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Well I would hope they would at least check the source lol
     
    JAY6390, Jan 9, 2010 IP
  16. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #16
    I know mate, but he did say he's new to php, I cant remember back when I started, but I am sure I did some silly things at the time, not knowing any better, I guess its how we learn.
     
    MyVodaFone, Jan 9, 2010 IP
  17. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #17
    fair point :)
     
    JAY6390, Jan 9, 2010 IP
  18. uworks

    uworks Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Just check this link if you are using localhost. And make sure that your file extension is .php or .php3 or .php4 or .php5 or .phtml because its a silly mistake which anyone can do.
     
    uworks, Jan 9, 2010 IP
  19. rigas

    rigas Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    no :confused:
     
    rigas, Jan 9, 2010 IP
  20. rigas

    rigas Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    i have already installed xampp, put my file to the localhost root directory and checked the extension of the file (test.php)

    thank u for the reply
     
    rigas, Jan 9, 2010 IP