This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-05-15 20:28:48

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Email Form with Radiobuttons?

How would I set up a form in HTML and PHP with radiobuttons so when I click 'Submit', it emails my choices to a target email?

Last edited by SeptimusHeap (2012-05-15 20:29:05)


http://i46.tinypic.com/dw7zft.png

Offline

 

#2 2012-05-15 20:31:11

stevetheipad
Scratcher
Registered: 2011-08-06
Posts: 1000+

Re: Email Form with Radiobuttons?

Here's an html email form:

Code:

 <html><body><font face=Arial size=2> 
 <form method="post" action="contact.php"> 
 <table bgcolor=#ffffcc align=center> 
 <tr><td colspan=2><strong>Contact us using this form:</strong></td></tr> 
 <tr><td>Department:</td><td><select name="sendto"> <option value="info@mycompany.com">General</option> <option value="support@mycompany.com">Support</option> <option value="sales@mycompany.com">Sales</option> </select></td></tr> 
 <tr><td><font color=red>*</font> Name:</td><td><input size=25 name="Name"></td></tr> 
 <tr><td><font color=red>*</font> Email:</td><td><input size=25 name="Email"></td></tr> 
 <tr><td>Company:</td><td><input size=25 name="Company"></td></tr> 
 <tr><td>Phone:</td><td><input size=25 name="Phone"></td></tr> 
 <tr><td>Subscribe to<br> mailing list:</td><td><input type="radio" name="list" value="No"> No Thanks<br> <input type="radio" name="list" value="Yes" checked> Yes, keep me informed<br></td></tr> 
 <tr><td colspan=2>Message:</td></tr> 
 <tr><td colspan=2 align=center><textarea name="Message" rows=5 cols=35></textarea></td></tr> 
 <tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr> 
 <tr><td colspan=2 align=center><small>A <font color=red>*</font> indicates a field is required</small></td></tr> 
 </table> 
 </form> 
 </body> 
 </html>

http://i.imgur.com/0x8ia.jpg
gone

Offline

 

#3 2012-05-15 20:31:20

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: Email Form with Radiobuttons?

SeptimusHeap wrote:

How would I set up a form in HTML and PHP with radiobuttons so when I click 'Submit', it emails my choices to a target email?

Looking for something like this?
HTML:

Code:

<form id = 'formname' action = 'action.php' method = 'POST'>
<fieldset>
<label>Subject</label><input type = 'text' name = 'subject' />
<br />
<label>Email to send to</label><input type = 'text' name = 'email' />
<br />
<label>Message</label> <textarea name = 'message' cols = '5' rows = '5'></textarea>
<br />
<label>From</label><input type = 'text' name = 'from' />
<br />
<input type = 'submit' name = 'submit' value = 'Submit' />
</fieldset>
</form>

PHP (at action.php):

Code:

<?php
$mail = mail($_POST['email'], $_POST['subject'], $_POST['message'], $_POST['from']);
if ($mail) {
echo "Email Sent";
}else{
echo "Error";
die();
}

Note that this is VERY INSECURE
I don't remember the secure way ATM.

Last edited by SJRCS_011 (2012-05-15 20:40:38)


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#4 2012-05-16 07:02:45

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Email Form with Radiobuttons?

WITH radiobuttons. That's my problem. WITH radiobuttons.


http://i46.tinypic.com/dw7zft.png

Offline

 

#5 2012-05-16 07:26:47

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: Email Form with Radiobuttons?

SeptimusHeap wrote:

WITH radiobuttons. That's my problem. WITH radiobuttons.

How would that be any different?  You just check to see which radio button is pressed, and then email accordingly.


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#6 2012-05-16 08:16:00

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Email Form with Radiobuttons?

SJRCS_011 wrote:

SeptimusHeap wrote:

WITH radiobuttons. That's my problem. WITH radiobuttons.

How would that be any different?  You just check to see which radio button is pressed, and then email accordingly.

That's the thing, though. That's very difficult.


http://i46.tinypic.com/dw7zft.png

Offline

 

#7 2012-05-16 15:28:05

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: Email Form with Radiobuttons?

SeptimusHeap wrote:

SJRCS_011 wrote:

SeptimusHeap wrote:

WITH radiobuttons. That's my problem. WITH radiobuttons.

How would that be any different?  You just check to see which radio button is pressed, and then email accordingly.

That's the thing, though. That's very difficult.

Could you give us an example of an HTML form with radio buttons you want?  I'd take care of the PHP


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#8 2012-05-16 17:16:04

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Email Form with Radiobuttons?

SJRCS_011 wrote:

SeptimusHeap wrote:

SJRCS_011 wrote:


How would that be any different?  You just check to see which radio button is pressed, and then email accordingly.

That's the thing, though. That's very difficult.

Could you give us an example of an HTML form with radio buttons you want?  I'd take care of the PHP

I don't want you to make one for me, I want advice.


http://i46.tinypic.com/dw7zft.png

Offline

 

#9 2012-05-16 17:56:32

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: Email Form with Radiobuttons?

SeptimusHeap wrote:

SJRCS_011 wrote:

SeptimusHeap wrote:


That's the thing, though. That's very difficult.

Could you give us an example of an HTML form with radio buttons you want?  I'd take care of the PHP

I don't want you to make one for me, I want advice.

check to see if the radio button is pressed or not, then do whatever php stuff you have to.


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

Board footer