Jump to content

Radio button echo selection


gerbs987

Recommended Posts

Hi. i'm fairly new to PHP, and i've run into a bit of a problem.  I am trying to set up a website for myself and friends to use for an NFL pool  However, i want to create a selection page where the user may select which teams he/she believes will win and not only put this info into an email to myself(which i've already been able to do), but to also echo their selections back to them after they click the submit button.  Is this at all possible?  I just want to do this so that the users can double check their picks after submitting, and then that way they can either re-submit, or print off their own choices.  Any help is greatly appreciated.

Link to comment
Share on other sites

I don't know how proficent your php is but thats a lot to chew off for a no0bie (i mean that because its your tag on the forum)

It will include all of the following and more

 

1) Mysql Databasing

2) User registration

3) User login

4) mail() function

5) Variable passing via POST and phrasing of them

6) A lot more I can't even think of right now

Link to comment
Share on other sites

it's not meant to have a database, or user registration.  last year i ran this pool, and it was simple.  the user came to the site, selected what they wanted in the form, put in their screen name, and hit submit which would send their choices to me in an email.  all i'm looking to do now is change the form from check boxes, to radio buttons(or keep it as check boxes if it's easier) and when they click submit, still have the email sent to me, but also just display the choices back to them.  hopefully that helps.

Link to comment
Share on other sites

ok.  well i just don't really know where to start.  i have the existing page that i used last year, but i just wanted to maybe use variables in the form, that i could echo later, but that's where i'm unsure, and don't know where to start.

Link to comment
Share on other sites

ok.  here's the code for the index page that i use.  and i had help on building this from a friend.  i was able to do some of it, but was unable to do the email function on my own.

 

<?php function show_form() { ?>

 

<center><body><h2><img src="nfl.jpg"><b><font face="arial">Winnipegfootballpool.com</b></font></h2>

 

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

 

<b><u><a href="info.html"><font face="arial">RULES & INFO</font></a></b></u><br>

<b><u><font face="arial"><a href="standings.html">POOL STANDINGS</a></font></u></b><br>

<b><u><font face="arial"><a href="table.html">SPREADSHEET</a></font></b></u>

 

<p><b><u><font face="arial">THURSDAY SEPT. 07/2006 7:30PM</font></u></b></p>

 

<font face="comic sans ms"><input name="1" type="checkbox" value="Miami Dolphins">MIAMI DOLPHINS @ PITTSBURGH STEELERS<input name="2" type="checkbox" value="Pittsburgh Steelers"><br></font><p>

 

<b><u><font face="arial">SUNDAY SEPT. 10/2006 12:00PM</font></u></b></p>

 

<font face="comic sans ms"><input name="3" type="checkbox" value="Atlanta Falcons">ATLANTA FALCONS @ CAROLINA PANTHERS<input name="4" type="checkbox" value="Carolina Panthers"><br>

 

<input name="5" type="checkbox" value="Baltimore Ravens">BALTIMORE RAVENS @ TAMPA BAY BUCCANEERS<input name="6" type="checkbox" value="Tampa Bay Buccaneers"><br>

 

<input name="7" type="checkbox" value="Buffalo Bills">BUFFALO BILLS @ NEW ENGLAND PATRIOTS<input name="8" type="checkbox" value="New England Patriots"><br>

 

<input name="9" type="checkbox" value="Cincinnati Bengals">CINCINNATI BENGALS @ KANSAS CITY CHIEFS<input name="10" type="checkbox" value="Kansas City Chiefs"><br>

 

<input name="11" type="checkbox" value="Denver Broncos">DENVER BRONCOS @ ST. LOUIS RAMS<input name="12" type="checkbox" value="St. Louis Rams"><br>

 

<input name="15" type="checkbox" value="New Orleans Saints">NEW ORLEANS SAINTS @ CLEVELAND BROWNS<input name="16" type="checkbox" value="Cleveland Browns"><br>

 

<input name="17" type="checkbox" value="New York Jets">N.Y. JETS @ TENNESSEE TITANS<input name="18" type="checkbox" value="Tennessee Titans"><br>

 

<input name="19" type="checkbox" value="Philadelphia Eagles">PHILADELPHIA EAGLES @ HOUSTON TEXANS<input name="20" type="checkbox" value="Houston Texans"><br>

 

<input name="21" type="checkbox" value="Seattle Seahawks">SEATTLE SEAHAWKS @ DETROIT LIONS<input name="22" type="checkbox" value="Detroit Lions"><br><p></font>

 

<p><u><b><font face="arial">3:15PM GAMES</font></u></b></p>

 

<font face="comic sans ms"><input name="23" type="checkbox" value="Chicago Bears">CHICAGO BEARS @ GREEN BAY PACKERS<input name="24" type="checkbox" value="Green Bay Packers"><br>

 

<input name="25" type="checkbox" value="Dallas Cowboys">DALLAS COWBOYS @ JACKSONVILLE JAGUARS<input name="26" type="checkbox" value="Jacksonville Jaguars"><br>

 

<input name="27" type="checkbox" value="San Francisco 49ers">SAN FRANCISCO 49ERS @ ARIZONA CARDINALS<input name="28" type="checkbox" value="Arizona Cardinals"><br></font>

 

<p><u><b><font face="arial">7:15PM GAME</font></b></u></p>

 

<font face="comic sans ms"><input name="29" type="checkbox" value="Indianapolis Colts">INDIANAPOLIS COLTS @ N.Y. GIANTS<input name="30" type="checkbox" value="New York Giants"><br></font>

 

<p><u><b><font face="arial">MONDAY SEPT. 11/2006 6:00PM</font></b></u></p>

 

<font face="comic sans ms"><input name="13" type="checkbox" value="Minnesota Vikings">MINNESOTA VIKINGS @ WASHINGTON REDSKINS<input name="14" type="checkbox" value="Washington Redskins"><br>

 

<p><u><b><font face="arial">MONDAY SEPT. 11/2006 9:15PM</font></b></u></p>

 

<input name="31" type="checkbox" value="San Diego Chargers">SAN DIEGO CHARGERS @ OAKLAND RAIDERS<input name="32" type="checkbox" value="Oakland Raiders"><br></font>

 

<p><b><font face="arial">TOTAL POINTS SCORED ON MNF:<input type="text" name="33" maxlength="3" size="3"><a href="what.html">What's This?</b></font></a>

 

<p><font face="arial"><b>NAME:<input type="text" name="name" maxlength="16"></b></font><br>

 

<input type="submit" value="Submit This Week's Picks!"><input type="reset" value="Clear Form"></p>

</form>

</body>

</center>

</html>

<? }

if(!isset($_POST['name'])){

show_form();

exit;

}

foreach($_POST as $key => $value){

$loler[$key] = $value;

}

if(sizeof($array) > 3){

echo "only select 1 please";

show_form();

exit;

}

$to = "bryan.treller@shaw.ca";

$subject = $_POST['name'];

foreach($loler as $key => $value){

$string .= $value."\n";

}

$headers = "From:bryant@winnipegfootballpool.com";

mail($to, $subject, $string, $headers);

echo '<h2><b><font face="arial">Thanks for submitting your picks!</font></b></h2>';

?>

Link to comment
Share on other sites

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.