SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <?php echo $txt...

    Hello,

    am hoping someone here could help me. In the code below:


    //name validations
    if(empty($_POST['name']))
    {
    $this->add_error("Please provide your name");
    $ret = false;
    }
    else
    if(strlen($_POST['name'])>50)

    ________________________________
    I would like to replace the highlighted part above with:

    <?php echo $txt["providename"] ?>

    Can someone help? Thanks much!

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    Well, since you're already inside the PHP tags, take everything from the " to the " out, and stick $txt['providedname'] inside the parenthesis instead.

  3. #3
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did that but it didn't work. When I test it, the error message doesn't show.
    I just get a blank white space.

  4. #4
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,032
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    If your using like the below in an echo:

    PHP Code:
    $txt['providedname'
    then you should put { } around it

    PHP Code:
    {$txt['providedname']} 
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  5. #5
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just tried it. That didn't work either.

    It looks like it should be simple...but I guess not.
    I hope someone can help...

  6. #6
    SitePoint Zealot Zurev's Avatar
    Join Date
    Feb 2009
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you on a production server that has error reporting off by chance? In which case it could be getting sent to logs, if you have a "error_log" in the directory you're working in, check that. Otherwise I think it's /var/log/error_log.

  7. #7
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I'm not on a production server. There is no error_log directory.

    My other forms are working fine - with error reporting using <?php echo $txt["providename"]" ?>

    I am testing this form found @ Making a contact form with file upload support

    Am trying to integrate it on my "self-tutoring" test site. It works fine, but it just won't allow the " echo $txt["....."]" modification.

    If anyone could check the form above and help me out, I'd be much obliged.

    I'm a layman teaching myself web development.

  8. #8
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem with this script is that PHP treats anything contained within [''] type syntax as being part of an array.

    What you need to do is something like this:

    import_request_variables('p','p_');
    print($p_name);

    Hope this helps.

    John


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
  •