Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Getting my mailer to get data from a radio button
Old 06-29-2010, 12:01 PM Getting my mailer to get data from a radio button
Novice Talker

Posts: 5
Name: Chris
Trades: 0
I have a mailer that allows people to submit questions and request an email newsletter signup.

I don't know how to make the radio button information appear in my forwarded email. I am realy new to php script. (last time i wrote code was 7 years ago and that was VB).

So this is the code I use to generate the two emails. One goes to me and the other goes to the user. I was trying to figure out how to make it send two different emails depending on if the radio button was selected. Basicaly one to say thanks for the interest someone will contact you soon. The other to say the same but with the line Thank you for signing up for our email newsletter added to the end.

First code is my form.(don't kill me for using tables)

HTML Code:
<table align="center" style="font; width: 400px;" cellspacing="3" cellpadding="3"> 
        <tr><td>
                        &nbsp; First Name<br />
                        <input size="25" name="FirstName" class="style116" style="width: 190px"/></td> 
        <td class="style116" colspan="2">&nbsp; Last Name<br />
        <input size="25" name="LastName" class="style116"/></td></tr> 
        <tr><td colspan="3">
                        &nbsp; Address<br />
                        <input size="54" name="Address" class="style116"/></td></tr> 
        <tr><td>
                        &nbsp; City<br />
                        <input size="25" name="City" class="style116"/></td><td>
                        &nbsp; State /Province<br />
                        <input size="13" name="State" class="style116"/></td><td>
                        &nbsp; Zip Code<br />
                        <input size="9" name="Zip" class="style116"/></td></tr> 
        <tr><td>&nbsp; Country (if not in the US)<br />
                        <input size="25" name="Country" class="style116"/></td><td colspan="2">
                        &nbsp;</td></tr> 
        <tr><td>&nbsp; Phone<br />
                        <input size="25" name="Phone" class="style116"/></td>
                        <td colspan="2">
                        &nbsp; E-mail<br />
                        <input size="25" name="Email" class="style116"/></td></tr> 
        <tr><td colspan="3" align="center" class="style116">
                        &nbsp; Comments or Questions<br />
                        <textarea name="Comments" rows="5" cols="52" class="style116"></textarea></td></tr> <tr>
        <td colspan="3" class="style117">
        <input name="remail" type="radio" /> Check here to sign up for the 
        mysite E-mail newsletter</td></tr> <tr>
        <td colspan="3" class="style117">
        <input type="reset" class="btn" value="  Clear  " name="Clear1"/>&nbsp; <input type="submit" name="send" value="Submit"/> </td></tr> </table> </form> 
        </td>
        </tr>
    </table>
and this it the php page that the form submits to.

PHP Code:
<?php 
ini_set
("sendmail_from",$_REQUEST['Email']); 
$to "webmaster@mysite.org" ;
 
$from $_REQUEST['Email'] ;
  
$name $_REQUEST['FirstName'] ;
   
$headers "From: $from";
    
$subject "Web Contact Data";
     
$fields = array();
      
$fields{"FirstName"} = "First Name";
       
$fields{"LastName"} = "Last Name";
        
$fields{"Address"} = "Address";
         
$fields{"City"} = "City";
          
$fields{"State"} = "State";
           
$fields{"Zip"} = "Zip";
            
$fields{"Country"}= "Country";
             
$fields{"Phone"}= "Phone";
              
$fields{"Email"}= "E-mail";
              
$fields{"Comments"}= "Comments";
            
$body "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]);} 
             
$headers2 "From: noreply@mysite.org";
               
$subject2 "Thank you for contacting us";
                
$autoreply "Thank you for contacting us. Someone will get back to you as soon as possible.";
                 if(
$from == '') {print "You have not entered an email, please go back and try again";} else { if($name == ''
                 {print 
"You have not entered a name, please go back and try again";} else 
                 { 
$send mail($to$subject$body$headers); 
                 
$send2 mail($from$subject2$autoreply$headers2); 
                 if(
$send) {header"Location: http://www.mysite.org/Contact" );
                 } else {print 
"We encountered an error sending your mail, please notify webmaster@mysite.org"; } } } ?>
So I don't understand how to make the radio button work properly.

Thanks for any help
Chris
DKLD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-29-2010, 05:00 PM Re: Getting my mailer to get data from a radio button
Skilled Talker

Posts: 64
Name: Ralph Freshour
Trades: 0
I only see one radio button item. Is that right? If you're using your radio button just to indicate the user wants to sign up for your newsletter, then use a checkbox. You don't need a radio button for one item.

(Or have I missed another radio button?)
__________________
RalphF
Business Text Messaging Services

Please login or register to view this content. Registration is FREE
rfresh is offline
Reply With Quote
View Public Profile
 
Old 06-30-2010, 12:36 PM Re: Getting my mailer to get data from a radio button
prasanthmj's Avatar
Experienced Talker

Posts: 42
Name: Prasanth
Trades: 0
The code for the tick box should be:

HTML Code:
<input name="remail" type="checkbox" /> Check here to sign up for the mysite E-mail newsletter
then add a line
PHP Code:
$fields{"remail"}= "remail"
to the PHP part
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
prasanthmj is offline
Reply With Quote
View Public Profile
 
Old 07-06-2010, 11:26 AM Re: Getting my mailer to get data from a radio button
Novice Talker

Posts: 5
Name: Chris
Trades: 0
Thanks for the help. I cant believe I missed that. It's always the little things.
DKLD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Getting my mailer to get data from a radio button
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13652 seconds with 12 queries