Jump to content

Trying to INSERT a form with 64 separate answers...


Recommended Posts

I'm trying to expand a form that currently just Inserts the User's information then emails me the results. They give me their name, email address, and favorite school, then they pick the winners of 64 sectional rounds.

 

Currently I copy and paste all the emailed results into a spreadsheet and grade it against a master list. I'd like to input their answers into a datatable. I assume it will be a separate table than where the User information is input, linking it to their ID.

 

Loop? Build an array? The latter I'm awful at, and whenever I search for it here and elsewhere, I never seem to quite find what I'm looking for.

 

$nameFirst = $_POST['nameFirst'];
$nameLast = $_POST['nameLast'];
$email = $_POST['email'];
$school = $_POST['school'];


$sql="INSERT INTO hhr_sectionals SET
year='2013',
nameFirst='".$nameFirst."',
nameLast='".$nameLast."',
email='".$email."',
school='".$school."'";


if (!mysql_query($sql,$con))
 {
 die('Error: ' . mysql_error());
 }
 // header( 'Location: /fall-league/payment' );

mysql_close($con)

?>



<?php
// The message
$message =  $_POST['nameFirst'] . " " . $_POST['nameLast'] . "\n";

$message .=  $_POST['email'] . "\n";
$message .=  $_POST['school'] . "\n\n";

$message .= $_POST['1'] . "  :: Sectional #1\n";
$message .= $_POST['2'] . "  :: Sectional #2\n";
$message .= $_POST['3'] . "  :: Sectional #3\n";
$message .= $_POST['4'] . "  :: Sectional #4\n";
$message .= $_POST['5'] . "  :: Sectional #5\n";
$message .= $_POST['6'] . "  :: Sectional #6\n";
$message .= $_POST['7'] . "  :: Sectional #7\n";
$message .= $_POST['8'] . "  :: Sectional #8\n";
$message .= $_POST['9'] . "  :: Sectional #9\n";
$message .= $_POST['10'] . "  :: Sectional #10\n";
$message .= $_POST['11'] . "  :: Sectional #11\n";
$message .= $_POST['12'] . "  :: Sectional #12\n";
$message .= $_POST['13'] . "  :: Sectional #13\n";
$message .= $_POST['14'] . "  :: Sectional #14\n";
$message .= $_POST['15'] . "  :: Sectional #15\n";
$message .= $_POST['16'] . "  :: Sectional #16\n\n";


$message .= $_POST['17'] . "  :: Sectional #17\n";
$message .= $_POST['18'] . "  :: Sectional #18\n";
$message .= $_POST['19'] . "  :: Sectional #19\n";
$message .= $_POST['20'] . "  :: Sectional #20\n";
$message .= $_POST['21'] . "  :: Sectional #21\n";
$message .= $_POST['22'] . "  :: Sectional #22\n";
$message .= $_POST['23'] . "  :: Sectional #23\n";
$message .= $_POST['24'] . "  :: Sectional #24\n";
$message .= $_POST['25'] . "  :: Sectional #25\n";
$message .= $_POST['26'] . "  :: Sectional #26\n";
$message .= $_POST['27'] . "  :: Sectional #27\n";
$message .= $_POST['28'] . "  :: Sectional #28\n";
$message .= $_POST['29'] . "  :: Sectional #29\n";
$message .= $_POST['30'] . "  :: Sectional #30\n";
$message .= $_POST['31'] . "  :: Sectional #31\n";
$message .= $_POST['32'] . "  :: Sectional #32\n\n";


$message .= $_POST['33'] . "  :: Sectional #33\n";
$message .= $_POST['34'] . "  :: Sectional #34\n";
$message .= $_POST['35'] . "  :: Sectional #35\n";
$message .= $_POST['36'] . "  :: Sectional #36\n";
$message .= $_POST['37'] . "  :: Sectional #37\n";
$message .= $_POST['38'] . "  :: Sectional #38\n";
$message .= $_POST['39'] . "  :: Sectional #39\n";
$message .= $_POST['40'] . "  :: Sectional #40\n";
$message .= $_POST['41'] . "  :: Sectional #41\n";
$message .= $_POST['42'] . "  :: Sectional #42\n";
$message .= $_POST['43'] . "  :: Sectional #43\n";
$message .= $_POST['44'] . "  :: Sectional #44\n";
$message .= $_POST['45'] . "  :: Sectional #45\n";
$message .= $_POST['46'] . "  :: Sectional #46\n";
$message .= $_POST['47'] . "  :: Sectional #47\n";
$message .= $_POST['48'] . "  :: Sectional #48\n\n";


$message .= $_POST['49'] . "  :: Sectional #49\n";
$message .= $_POST['50'] . "  :: Sectional #50\n";
$message .= $_POST['51'] . "  :: Sectional #51\n";
$message .= $_POST['52'] . "  :: Sectional #52\n";
$message .= $_POST['53'] . "  :: Sectional #53\n";
$message .= $_POST['54'] . "  :: Sectional #54\n";
$message .= $_POST['55'] . "  :: Sectional #55\n";
$message .= $_POST['56'] . "  :: Sectional #56\n";
$message .= $_POST['57'] . "  :: Sectional #57\n";
$message .= $_POST['58'] . "  :: Sectional #58\n";
$message .= $_POST['59'] . "  :: Sectional #59\n";
$message .= $_POST['60'] . "  :: Sectional #60\n";
$message .= $_POST['61'] . "  :: Sectional #61\n";
$message .= $_POST['62'] . "  :: Sectional #62\n";
$message .= $_POST['63'] . "  :: Sectional #63\n";
$message .= $_POST['64'] . "  :: Sectional #64\n\n";


// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

$headers = 'From: ' . $_POST['nameFirst'] . " " . $_POST['nameLast'] . "<" . $_POST['email'] . ">";

// Send
mail('basketball@hoosierhoopsreport.com', 'Sectional Pick-em Contest 2013', $message, $headers);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.