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 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    displaying a url as an echo

    I am making a page generator, and I am making a page where you can view your own page, so far I have this...
    PHP Code:
    <?php
    $page2 
    $_POST['pageid'];
    $page "{$page2}.html";

    echo 
    ' <a href="http://www.tackypenguin.com/freepages/$page">Continue</a> ';
    ?>
    when i fill out the form I made, it says continue but it goes to http://www.tackypenguin.com/freepages/$page exactly like that. so say I put in ryan in the form it generates http://www.tackypenguin.com/freepages/$page. It is supposed to generate http://www.tackypenguin.com/freepages/ryan.html

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    PHP won't parse variables in your string unless you use double quotes. You can use concatenation too:
    PHP Code:
    echo '<a href="http://www.tackypenguin.com/freepages/' $_POST['pageid'] . '.html">Continue</a> '
    Also, it's a good idea to remove any invalid characters from user input before you use it. ereg_replace() preg_replace()

  • #3
    New Coder
    Join Date
    Mar 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    okay thank 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
    •