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
    Aug 2005
    Posts
    71
    Thanks
    9
    Thanked 3 Times in 3 Posts

    Problem getting var data to display

    I have the following code snippet for a custom 404 error page

    Code:
    print start_html (-title=>"Page Error",
                 -style=>{-src=>'../test/css/page.css'}),
    
    h1('Error - Page Not Found!'),
    'We're sorry, but the page you were looking for has either been changed, ',
    'moved, or has been deleted.   Please return to our ',
    a({href=>'http://www.homepage.us'},'homepage'),' to locate the proper page.  ',
    'You may also fill out the form below to help us better understand why you ',
    'arrived at this error page.',br,br,'If you arrived at this page via a ',
    '"bookmark", please delete the link as it no longer works.',
    br,hr,br,
    end_html;
    print start_form,
    'Email address <optional>:  ',br,
    textfield('email','',35),
    br,br,
    ############ problem code here
    'Page you were trying to find',br,
    textfield('page',$last_line,50),
    br,br,
    'Additional information:',br,
    textarea('comments','',4,40),
    br,br,
    submit,
    end_form;
    As is, the error page url stored in $last_line shows up in the text box fine. If I change it to display the url inline with text as so

    Code:
    'You tried to access $last_line.',
    it displays "You tried to access $last_line." I prefer to display with inline text rather than a text box. I know I am overlooking something simple here, I just can't put my finger on it. Any suggestions?
    Last edited by Budreaux; 04-05-2010 at 10:22 PM. Reason: fix code typing error
    It's OK to pee against the wind if your standing in a lake.

  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    71
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Ok, figured out my problem. For the curious below is the corrected code. I needed to put the var outside the quotes for it to work.

    Code:
    'You tried to access ',$last_line,'.',
    It's OK to pee against the wind if your standing in a lake.

  • #3
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,869
    Thanks
    2
    Thanked 163 Times in 158 Posts
    Single quotes don't allow for variable interpolation. Change them to double quotes.
    Code:
    "You tried to access $last_line.",


  •  

    Posting Permissions

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