Page 1 of 1

Custom Tag

Posted: Sat Feb 18, 2006 5:45 am
by damosky
Hey all,

I am trying to put up a contact form that I have previously used but it doesn't seem to be passing the variable along. Below are my steps:

1. Set up user tag {contact_submitted}
$SiteName = "http://www.sitename.com";
$SiteEmail = "admin@site.com";
$ip = $REMOTE_ADDR;
echo 'Thankyou $UserName for your message.';
$AdminMessage .= "$UserName, Submitted the following Information:\n\n";
$AdminMessage .= "Full Name: $UserName\n";
$AdminMessage .= "E-mail: $UserEmail\n";
$AdminMessage .= "Comments: $UserComments\n\n";
mail("$SiteEmail", "$SiteName", $AdminMessage, "From: $UserEmail");

2. Set form up with following:

   
       
           
                Name:
               
           
           
                Email:
               
           
           
                Message:
               
           
           
                 
               
           
       
   


3. Insert user tag into contact_submitted.

Basically none of the information is being passed to the Contact Submitted page. I am going to most likely try and use the Form module but was wondering why it was wasn't working for future reference.

Cheers
Damian

Re: Custom Tag

Posted: Sat Feb 18, 2006 3:06 pm
by Ted
You're making an assumption that register_globals is on, which it most likely is not, since the default in php these days is to have it off.

So, instead of

Code: Select all

$AdminMessage .= "$UserName, Submitted the following Information:\n\n";
do:

Code: Select all

$AdminMessage .= $_POST['UserName'].", Submitted the following Information:\n\n";
Plus this way is a lot safer.  You can sanitize the input without worrying that someone is going to hack around it.

Hope that helps!

Re: Custom Tag

Posted: Sun Feb 19, 2006 1:11 am
by damosky
Cheers thanks Wishy