Rank: Legend
Posts: 22,880 Joined: 10/14/2006(UTC) Location: United States
Applause Given: 1,294 Applause Received: 905
|
Okay, effective, umm, now. No more host switching until next off season. I'm going to focus on learning PHP in a similar fashion that I know ASP.NET. Click HERE to see the page. Building the form, easy. Coding the connection to the database, easy. Grabbing the values from the radio buttons and storing them into variables to transfer to a database, kicking my ass. I think I'm attacking this wrong because I'm using HTML code, but shouldn't I be able to use straight PHP code throughout? Edit, here's how I'm starting out ... http://w3schools.com/php/php_syntax.asplol |
|
|
|
|
|
|
|
|
|
|
Rank: Pro Bowl
Posts: 3,463 Joined: 8/7/2008(UTC)
Applause Given: 4 Applause Received: 26
|
I have no idea what you are talking about, but thanks for keeping this site running!
|
|
|
|
|
|
Rank: 2nd Round Draft Pick
Posts: 1,747 Joined: 8/7/2008(UTC) Location: Milwaukee
Applause Given: 8 Applause Received: 11
|
I'm not sure this will help you understand, my comments might not be helpful if you're just learning. Save this as "pickem.php": 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>Untitled Poop</title> </head>
<?php // start php
// see if the GET variable "picks" is set if(isset($_GET["picks"])) { // if picks is equal to "yes" proceed if($_GET["picks"] == "yes") { echo "<strong>You picked the following winners:</strong><br />"; // if the GET variable "picks" is set, show picks // variables for the form are stored in an array called $_POST[] // the value for the array is the name of the input field i.e., rdoGame01 // go through the post variable and display picks // assign variables $games = 16; // number of games // if variable $x is less than the total number of games, add 1 to $x for($x = 0; $x <= 16; $x++) { // check games if($x < 10) { $x = "0" . $x . ""; } if(isset($_POST["rdoGame" . $x . ""])) { // do whatever you want with each game right here if($x != "1") {echo ", ";} echo $_POST["rdoGame" . $x . ""] . ""; } } echo "<br /><br />"; } }
?>
<body> <form action="pickem.php?picks=yes" method="post"> <table width="372" border="1"> <tr> <td colspan="4"><div align="center">Week One </div></td> </tr>
<tr> <td width="56">Thursday</td> <td width="127"><input name="rdoGame01" type="radio" value="Titans" /> Tenneesee </td> <td width="17">at</td> <td width="144"><input name="rdoGame01" type="radio" value="Steelers" /> Pittsburgh</td>
</tr> <tr> <td height="24">Sunday</td> <td><input name="rdoGame02" type="radio" value="Dolphins" /> Miami </td> <td>at</td> <td><input name="rdoGame02" type="radio" value="Falcons" />
Atlanta</td> </tr> <tr> <td>Sunday</td> <td><input name="rdoGame03" type="radio" value="Broncos" /> Denver </td> <td>at</td>
<td><input name="rdoGame03" type="radio" value="Bengals" /> Cincinnati</td> </tr> <tr> <td>Sunday</td> <td><input name="rdoGame04" type="radio" value="Packers" /> Minnesota </td>
<td>at</td> <td><input name="rdoGame04" type="radio" value="Packers" /> Cleveland</td> </tr> <tr> <td>Sunday</td> <td><input name="rdoGame05" type="radio" value="Packers" />
Jacksonville </td> <td>at</td> <td><input name="rdoGame05" type="radio" value="Packers" /> Indianapolis</td> </tr> <tr> <td>Sunday</td>
<td><input name="rdoGame06" type="radio" value="Packers" /> Detroit </td> <td>at</td> <td><input name="rdoGame06" type="radio" value="Packers" /> New Orleans</td> </tr> <tr>
<td>Sunday</td> <td><input name="rdoGame07" type="radio" value="Packers" /> Dallas </td> <td>at</td> <td><input name="rdoGame07" type="radio" value="Packers" /> Tampa Bay</td> </tr>
<tr> <td>Sunday</td> <td><input name="rdoGame08" type="radio" value="Packers" /> Philadelphia </td> <td>at</td> <td><input name="rdoGame08" type="radio" value="Packers" /> Carolina</td>
</tr> <tr> <td>Sunday</td> <td><input name="rdoGame09" type="radio" value="Packers" /> Kansas City</td> <td>at</td> <td><input name="rdoGame09" type="radio" value="Packers" />
Baltimore</td> </tr> <tr> <td>Sunday</td> <td><input name="rdoGame10" type="radio" value="Packers" /> NY Jets</td> <td>at</td>
<td><input name="rdoGame10" type="radio" value="Packers" /> Houston</td> </tr> <tr> <td>Sunday</td> <td><input name="rdoGame11" type="radio" value="Packers" /> Washington </td>
<td>at</td> <td><input name="rdoGame11" type="radio" value="Packers" /> NY Giants</td> </tr> <tr> <td>Sunday</td> <td><input name="rdoGame12" type="radio" value="Packers" />
San Francisco</td> <td>at</td> <td><input name="rdoGame12" type="radio" value="Packers" /> Arizona</td> </tr> <tr> <td>Sunday</td>
<td><input name="rdoGame13" type="radio" value="Packers" /> St. Louis</td> <td>at</td> <td><input name="rdoGame13" type="radio" value="Packers" /> Seattle</td> </tr> <tr>
<td>Sunday</td> <td><input name="rdoGame14" type="radio" value="Packers" /> Chicago </td> <td>at</td> <td><input name="rdoGame14" type="radio" value="Packers" /> Green Bay</td> </tr>
<tr> <td>Monday</td> <td><input name="rdoGame15" type="radio" value="Packers" /> Buffalo </td> <td>at</td> <td><input name="rdoGame15" type="radio" value="Packers" /> New England</td>
</tr> <tr> <td>Monday</td> <td><input name="rdoGame16" type="radio" value="Packers" /> San Diego</td> <td>at</td> <td><input name="rdoGame16" type="radio" value="Packers" />
Oakland</td> </tr> </table> <div><input type="submit" value="Submit Picks" /></div></form> <p> </p> </body> </html>
|
|
|
|
|
|
|
Rank: Legend
Posts: 22,880 Joined: 10/14/2006(UTC) Location: United States
Applause Given: 1,294 Applause Received: 905
|
Very awesome of you, thank you for taking the time to do that. Unfortunately, I have to go to sleep now, but hopefully I can spend some time on this tomorrow. |
|
|
|
|
|
|
Rank: Pro Bowl
Posts: 3,523 Joined: 9/14/2008(UTC)
Applause Given: 12 Applause Received: 74
|
good job dj +1 for the code |
Just Imagine this for the next 6-9 years. What a ride it will be :) |
|
|
|
|
|
Rank: Super Bowl MVP
Posts: 6,247 Joined: 9/14/2008(UTC)
Applause Given: 104 Applause Received: 160
|
Originally Posted by: "  I have no idea what you are talking about, but thanks for keeping this site running! |
|
|
|
|
|
|
Rank: 1st Round Draft Pick
Posts: 2,609 Joined: 8/22/2009(UTC) Location: Milwaukee, WI
Applause Given: 144 Applause Received: 295
|
As crazy inefficient as it is, this makes me miss Visual Basic (6, of course. None of that .net sorcery). As a kid I'd spend afternoons and weekends experimenting with code, not having the slightest clue what I was doing until I got it to work and figured out why. Nowadays I'm working with shell scripts (linux), I miss that fluid feel VB6 had. Didn't miss having to make API calls for some more advanced graphical manipulation and trying to learn directx, but at its core it was streamlined and not as unusable for higher-end applications as most people say...
Regardless, a bit off-topic I suppose. I guess some people like making websites, some people like making computer games, and then there's database nerds. :P |
|
|
|
|
|
|
Rank: Dedicated Fan
Posts: 127 Joined: 9/28/2008(UTC)
|
Hooray...only spent $20000 on college so far and i understand the code....the system works!
good job man. Will have to see what i come up with in my spare time when im back at college |
|
|
|
|
|
|
Rank: 2nd Round Draft Pick
Posts: 1,747 Joined: 8/7/2008(UTC) Location: Milwaukee
Applause Given: 8 Applause Received: 11
|
Originally Posted by: "  good job dj +1 for the code Maybe I'll finally have to take you off my ignore list now :P I feel like I click to read your posts half the time anyway hah. @DKF295: I remember being a kid (not too long ago, in fact i'm probably still one now) and doing the same thing, albeit with websites. My dad was a website designer for over a decade so I kind of picked up the tools of the trade at a young age--not because I had too but because I found it fun. @grabacr: I haven't learned an ounce about PHP or web design in college. In fact my teacher gave me a B in my web design course because she disliked that I knew almost everything already. I'm not saying I'm a genius or anything or that you won't learn anything in college, I just happen to learn things better on my own. |
|
|
|
|
|
|
Rank: Legend
Posts: 22,880 Joined: 10/14/2006(UTC) Location: United States
Applause Given: 1,294 Applause Received: 905
|
dj, would you be willing to help me with this project? You're PHP skills are far superior to mine. I'm only good editing existing code. I could figure it out on my own, but having a genius help me would speed things up for shizzle. |
|
|
|
|
|
|
Rank: 2nd Round Draft Pick
Posts: 1,747 Joined: 8/7/2008(UTC) Location: Milwaukee
Applause Given: 8 Applause Received: 11
|
Originally Posted by: "  dj, would you be willing to help me with this project? You're PHP skills are far superior to mine. I'm only good editing existing code. I could figure it out on my own, but having a genius help me would speed things up for shizzle. I'll see what I can do. Schools a bit heavy now but come this weekend I might be able to set aside some time. |
|
|
|
|
|
|
Rank: Legend
Posts: 22,880 Joined: 10/14/2006(UTC) Location: United States
Applause Given: 1,294 Applause Received: 905
|
Originally Posted by: "  Originally Posted by: "  dj, would you be willing to help me with this project? You're PHP skills are far superior to mine. I'm only good editing existing code. I could figure it out on my own, but having a genius help me would speed things up for shizzle. I'll see what I can do. Schools a bit heavy now but come this weekend I might be able to set aside some time. Oh, you're in school. No worries, I don't want to take up any of your time. I know how it is with school, so no worries bud. :) I'm sure I'll figure it out. You've given me a great starting point. Thanks. |
|
|
|
|
|
|
Rank: All Pro
Posts: 5,427 Joined: 8/12/2008(UTC)
Applause Given: 190 Applause Received: 134
|
Originally Posted by: "  I'm not sure this will help you understand, my comments might not be helpful if you're just learning. Save this as "pickem.php": 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>Untitled Poop</title> </head>
-=snip snip=-
 |
Thanks to TheViking88 for the sig!! |
|
|
|
|
|
Rank: 1st Round Draft Pick
Posts: 2,609 Joined: 8/22/2009(UTC) Location: Milwaukee, WI
Applause Given: 144 Applause Received: 295
|
|
|
|
|
|
|
|
Rank: 4th Round Draft Pick
Posts: 861 Joined: 12/12/2007(UTC)
Applause Given: 12 Applause Received: 15
|
did u get ur form to work?? i work with php/mysql database driven forms A LOT. check boxes,radio buttons, drop down lists all the time. i do not think the code posted is correct. keep in mind u may have to edit more than 1 file and 1 function.
is there a template file a class file and a db file and a index file so to get the data to post to the database, and display on the form u may have to edit more than 1 file and 1 function. also, do you want to edit the selection, and give the user the ability to change a selection.
PHP is like c or java. u may need to edit a class and the functions within that class. |
So if you meet me Have some courtesy, Have some sympathy, and some taste Use all your well-learned politesse, Or I'll lay your soul to waste |
|
|
|
|
|
| Users browsing this topic |
|
Guest (2)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.