<?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!

Well, since you’re already inside the PHP tags, take everything from the " to the " out, and stick $txt[‘providedname’] inside the parenthesis instead.

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.

If your using like the below in an echo:

$txt['providedname']

then you should put { } around it

{$txt['providedname']}

Just tried it. That didn’t work either.

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

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.

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.

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