[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.6

How to input radio button and checkbox response into MySQL database?

Asked by duta in PHP Scripting Language

Tags: radio, database, input, button, mysql

Hi!

I am trying to create a simple online survey (using PHP and MySQL) which includes radio buttons, checkboxes and textareas.

Before posting this question, I spent quite a while reading the previously posted questions and responses about topics similar to mine.  But for some reason, I could not figure out. I am a real novice in PHP and MySQL.
I will truly appreciate if you experts may kindly help me out.

Thanks a lot!

duta

Tuesday (May 23, 2006) at 11:13 a.m.



__________ form.php  ______________________________________________


<html>
<head><title>PHP Survey-</title></head>
<body>

<form action="process.php" method="POST">
<ul>
<b>Please fill the form accurately.</b></FONT></ul>

<ul><ul>


<P><li><strong>Gender:</strong><br>
<INPUT TYPE="RADIO" NAME="gender" value="male" size="35">                     Male<br>
<INPUT TYPE="RADIO" NAME="gender" value="female" size="35">      Female<br>
<INPUT TYPE="RADIO" NAME="gender" value="neutral" size="35">      Neutral<br>

</li>

<P><li><strong>Favorite Fruits:</strong><br>
<INPUT TYPE="checkbox"      NAME="fruit"            value="Apple"      size="35">      Apple<br>
<INPUT TYPE="checkbox"      NAME="fruit"            value="Orange"       size="35">      Orange<br>
<INPUT TYPE="checkbox"      NAME="fruit"            value="Banana"      size="35">Banana<br>

</li>

<p><li><strong>What is your evaluation of this movie?</strong><p>

<select name="movie">
<option> Awesome!
<option> Good
<option> Poor
</select>

</li>
</ul></ul>
<ul><ul>

<p><li><strong>Write about Your Work Attitude: </strong><br>
<textarea NAME="block" cols="80" rows="10"><?php echo $_POST['block'] ?></textarea>

<br><br>
<INPUT TYPE="SUBMIT" NAME="SUBMIT"       VALUE="SUBMIT" >
<INPUT TYPE="RESET" NAME="RESET"       VALUE="RESET">

</li>
</ul></ul>
</FORM>
<hr>
</body>
</html>

______________ process.php _____________________________________________
<html>
<head>
<title>PHP Survey</title>
</head>
<body>
<?php


$gender = $_POST['gender'];
$fruit=$_POST['fruit'];
$movie = stripslashes($_POST['movie']);
$attitude =$_POST['block'];





if (!isset($gender))
echo("You didn't enter your gender<br>");

if (!isset($fruit))
echo("You didn't enter your race.<br>");

if (!isset($movie))
echo("You didn't enter your evaluation<br>");

if ( !isset($gender) || !isset($fruit) || !isset($movie) || !isset($attitude))
{
echo("<h3>" .$fname.",You responded the questions accurately; Thanks!</h3>");
echo "<h4> Here are your records </h4>";


echo ("<p>Gender: " . $gender);
echo ("<p>Fruits: " . $fruit);
echo ("<p>Movie: " . $movie);
echo ("<p>Attitude: " . $_POST['block']);
}
else

{
echo("<h2>Please, answer all questions</h2>");

}
$to  = 'duta@hotmail.com'';

// subject
$subject = 'Testing survey4 ';

// message
$message1 = "
<html>
<head>
  <title>Your Response </title>
</head>
<body>
  <p>Here are Your Response</p>
  <table width='76%' border='1' cellspacing='1' cellpadding='1'>

   <tr>
     <th> Gender </th><th>Fruits</th><th>Movie</th><th></th><th>Attitude</th></tr>
   
   <tr>
     <td align='center'>$gender</td><td align='center'>$fruits</td><td align='center'>$movie</td>
     <td align='center'>$attitude</td></tr>
  </table>
</body>
</html>
";
// $headers="<h2>Online Survey</h2>";
mail($to, $subject, $message1, $headers);



$conn = mysql_connect("localhost","my_user_name", "my_password");

if (!$conn)
{ die ('Could not connect:' . mysql_error());}
else
{echo "You are connected!<br>";}

 $sql="Create database my_db";
 mysql_query ($sql, $conn);

mysql_select_db ("my_db", $conn);

// Create table
$sql="create table my_table (gender enum('female', 'male', 'neutral'),fruit enum('apple' 'orange', 'banana'), movie enum('awesome', 'good', 'poor'), attitude text)";
mysql_query($sql, $conn);

// Insert date into MySql table
mysql_query ( "INSERT INTO my_table(gender,fruit,movie,attitude)
VALUES ('$gender', '$fruit','$movie','$attitude') " );
 echo "<br> Data inserted!";

// Output client's input

echo "<table width='76%' border='1' cellspacing='1' cellpadding='1'><tr><th>
Gender</th><th>Fruit</th><th>Email</th><th>Movie</th><th>Attitude</th>";


$result =mysql_query("SELECT * FROM my_table");
while ($row=mysql_fetch_array($result))
{
  echo '<tr><td>';
 
  echo $row['gender'];
  echo '</td>';
  echo '<td>';
  echo $row['fruit'];
  echo '</td>';
  echo '<td>';
  echo $row['movie'];
  echo '</td>';
   echo '<td>';
  echo $row['attitude'];
  echo '</td>';
  echo "</tr><br>";
   
}

echo "</table>";


?>

</body>
</html>

_____________________________________________________________________________________


[+][-]05/23/06 09:22 AM, ID: 16743865Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 09:27 AM, ID: 16743909Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 09:33 AM, ID: 16743967Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 09:37 AM, ID: 16744013Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 09:46 AM, ID: 16744104Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 09:49 AM, ID: 16744135Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 09:55 AM, ID: 16744193Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 09:57 AM, ID: 16744206Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 09:57 AM, ID: 16744214Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 10:21 AM, ID: 16744396Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 11:06 AM, ID: 16744828Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 11:24 AM, ID: 16744981Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 11:27 AM, ID: 16745012Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 11:31 AM, ID: 16745050Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 11:55 AM, ID: 16745283Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 01:09 PM, ID: 16745954Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 01:16 PM, ID: 16746003Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 02:55 PM, ID: 16746817Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 02:58 PM, ID: 16746832Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 07:04 PM, ID: 16748016Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Tags: radio, database, input, button, mysql
Sign Up Now!
Solution Provided By: jmar_click
Participating Experts: 2
Solution Grade: A
 
[+][-]05/23/06 08:19 PM, ID: 16748216Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/23/06 08:23 PM, ID: 16748233Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/23/06 08:56 PM, ID: 16748319Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/24/06 03:06 PM, ID: 16756299Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/24/06 08:28 PM, ID: 16757513Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89