Custom Tag

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
damosky

Custom Tag

Post 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
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Custom Tag

Post 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!
damosky

Re: Custom Tag

Post by damosky »

Cheers thanks Wishy
Locked

Return to “CMSMS Core”