Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 21st, 2006, 11:35 AM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JAMD
Default Getting Values from Radio Buttons via Email

First off, apologies if this has been brought up before - i used the advanced search but couldnt find anything relevant.

i have a questionnaire-style list with radio buttons allowing the user to select the ranging values


Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>User-Evaluation</title>
</head>

<body>


<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr> <form method="POST" action="thanks.php">
      <P>
    <td bgcolor="#CCCCCC"><h2><strong>Shakespeare User Evaluation </strong></h2>
      <p>&nbsp;</p>
      <h3>Number of Relevant Documents Found: </h3>
      <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
        <input type="radio" name="Rel_Docs" />
        All 

            <input type="radio" name="Rel_Docs" />
            Mostly 

            <input type="radio" name="Rel_Docs"checked="yes" />
            Some 

            <input type="radio" name="Rel_Docs" />
            Little 

            <input type="radio" name="Rel_Docs" />
            None</td>
      </tr>
    </table>
      <h3>Speed of Returning Results:</h3>
      <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><input type="radio" name="Speed" />
          Very 

            Fast
            <input type="radio" name="Speed" /> 
            Fast 

            <input type="radio" name="Speed" checked="yes"/>
            Reasonable
            <input type="radio" name="Speed" />
            Slow 

            <input type="radio" name="Speed" />
            Very Slow</td>
      </tr>
    </table>
    <h3>Ease of Use:</h3>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
            <input type="radio" name="Diff" />
            Very Easy 
            <input type="radio" name="Diff" />
            Quite Easy 

            <input type="radio" name="Diff"checked="yes" />
            Reasonable 

            <input type="radio" name="Diff" />
            Tricky 

            <input type="radio" name="Diff" />
            Very Hard&nbsp;</td>
      </tr>
    </table>
    <h3>Ease to Learn: </h3>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><input type="radio" name="Learn" />
          Very Easy 
            <input type="radio" name="Learn" />
            Quite Easy 

            <input type="radio" name="Learn"checked="yes" />
            Reasonable
            <input type="radio" name="Learn" /> 

            Tricky 

            <input type="radio" name="Learn" />
            Very Hard</td>
      </tr>
    </table>
    <h3>Number of Queries Ran: </h3>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
            <input type="radio" name="Queries" />
            Over 25 
            <input type="radio" name="Queries" />
            18-24 

            <input type="radio" name="Queries"checked="yes" />
            12-17 

            <input type="radio" name="Queries" />
            6-11
            <input type="radio" name="Queries" /> 

            1-5</td>
      </tr>
    </table>
    <h3>Comments/Suggestions on the System:</h3>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><textarea cols="80" rows="5"></textarea>&nbsp;</td>
      </tr>
    </table>
    <p>&nbsp;</p>
<p>Name:<input type="text" name="UserName" size="24" maxlength="24" />
    Age:<input type="text" name="Age" size="24" maxlength="2" />
    <input type="submit" value="Submit" />
    </P>

    <p><input type="reset" value="Reset Fields" />
    </form>
&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
</table>
</body>
</html>
and have some PHP which will email me what was filled in; however the email simply lets me see that the radio buttons are 'on' without returning which radio box was selected.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>thanks</title>
</head>

<body>
<script language="php">
$email = $HTTP_POST_VARS[email];
$mailto = "MYEMAILHERE";
$mailsubj = "Shakespeare Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
</script>
<h1>Thanks, </h1>
<h1>Form Submitted Sucessfully! </h1>
</body>
</html>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio Buttons and Calculations Student101 Java Basics 4 June 21st, 2009 11:02 AM
validation in radio buttons MunishBhatia ASP.NET 2.0 Professional 5 December 11th, 2007 11:15 AM
How to use the radio buttons? ben_VB VB.NET 2002/2003 Basics 1 January 18th, 2005 12:29 PM
Radio buttons over email??? morpheus Classic ASP Basics 5 April 20th, 2004 01:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.