Welcome to your Green Bay Packers Online Community!

Since 2006, PackersHome has been providing a unique experience for fans.
Your participation is greatly anticipated!
Login or Register.
7 Pages«<23456>»
Options
View
Go to last post Go to first unread
Offline dhpackr  
#46 Posted : Sunday, September 20, 2009 3:53:46 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

ok mind you i got 4 beers and three shots in me, and i'm gonna hack this during half time

some basic php from the top of my head
?> ----start PHP
&lt;tr&gt;
&lt;td &gt;<b>Your Pick&lt;font color=red&gt;*&lt;/font&gt;</b>:&lt;/td&gt;
&lt;td&gt;
&lt;input type="radio" name="dhpackr" value="1" class="textbox"&lt;?if($dhpackr=="1"){echo " checked ;}?&gt;> Packers&lt;br&gt;
&lt;input type="radio" name="dhpackr" value="0" class="textbox"&lt;?if($dhpackr=="0"){echo " checked ";}?&gt;> Bengals

&lt;/td&gt;

&lt;/tr&gt;

&lt;?---end PHP
game on i gota go, but There is an exAMPLE of using a PHP scriipt to add an radio selection
this will echo out your selection.
add the dhpackr to your select/insert mysql statement and you would need a different variable for each selection.
some basic validation

function check_pick() {
//if (Auth::isAdmin())

//return true;
this chunck of code allows admin to
bypass validation remove the slashes to make it so admin would have to check all boxes


$is_valid = true;
if($this-&gt;dhpackr==""){
$is_valid=false;
$this->add_error('Make a selection!');
}
return $is_valid;

}

this project would take some serous maintanence
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
Offline dhpackr  
#47 Posted : Sunday, September 20, 2009 6:57:13 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

i see some of ur errors now. if i could see the code i think i could make some progress
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
Offline Zero2Cool  
#48 Posted : Sunday, September 20, 2009 7:40:59 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

Errors? I haven't tried coding it yet.

I don't know exactly how to go about what I want to do, yet.


I attached the file in question for ya.


When the page is loaded,

Check username for that week (tbl2009Week01) and to see if they have a selection made for game 01.
if selection found,
display "Usernames seslected winners for Week 01"
if selection not found,
display table of all games,
when submit button clicked, check to see if all games have a selection,
if all games are selected,
send selection one by one to db,
if all games are not selected,
alert user and request all selections to be made


Sound reasonable or am I being foolish?

UserPostedImage
Click here and find the LATEST Packers News!
Offline dhpackr  
#49 Posted : Sunday, September 20, 2009 8:13:58 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

Originally Posted by: " Go to Quoted Post
Errors? I haven't tried coding it yet.

I don't know exactly how to go about what I want to do, yet.


I attached the file in question for ya.


When the page is loaded,

Check username for that week (tbl2009Week01) and to see if they have a selection made for game 01.
if selection found,
display "Usernames seslected winners for Week 01"
if selection not found,
display table of all games,
when submit button clicked, check to see if all games have a selection,
if all games are selected,
send selection one by one to db,
if all games are not selected,
alert user and request all selections to be made


Sound reasonable or am I being foolish?


no that is cool w/a few changes

i would create a new login page and new username and passwords.

you would have a form and have two fields username and password and the ability to create a new user as well

so....when a member clicked NFL Picks, it would take them to a login page.
the user could enter their username and password or create a new username and password. once they enter their username and password the would click a button this would take them to the weeks picks page.
you would have to change the text on the form every week
the picks could be entered into the db table based on their memberid. you would make this the primary key in the database and auto increment. so when the end user logs in, they are going to a weeks page that is unique to their id,

so their picks would be entered based on their login name.

so your page may look li ke this

?> ----start PHP
&lt;tr&gt;
&lt;td &gt;Pick1&lt;font color=red&gt;*&lt;/font&gt;:&lt;/td&gt;
&lt;td&gt;
&lt;input type="radio" name="Pick1" value="1" class="textbox"&lt;?if($Pick1=="1"){echo " checked ;}?&gt;> Packers&lt;br&gt;
&lt;input type="radio" name="Pick1" value="0" class="textbox"&lt;?if($Pick1=="0"){echo " checked ";}?&gt;> Bengals

&lt;/td&gt;

&lt;/tr&gt;


?> ----start PHP
&lt;tr&gt;
&lt;td &gt;Pick2&lt;font color=red&gt;*&lt;/font&gt;:&lt;/td&gt;
&lt;td&gt;
&lt;input type="radio" name="Pick2" value="1" class="textbox"&lt;?if($Pick2=="1"){echo " checked ;}?&gt;> Vikings&lt;br&gt;
&lt;input type="radio" name="Pick2" value="0" class="textbox"&lt;?if($Pick2=="0"){echo " checked ";}?&gt;> Lions

&lt;/td&gt;

&lt;/tr&gt;
and so on for 16 games, so you'll need 16 different variables in your database table.

the validation to make sure all picks are made

function check_pick() {
//if (Auth::isAdmin())

//return true;
this chunck of code allows admin to
bypass validation remove the slashes to make it so admin would have to check all boxes


$is_valid = true;
if($this->pick1=="" or $this->pick2=="" ){
$is_valid=false;
$this->add_error('Make a selection!');
}
return $is_valid;

}


the first part of code goes in your template file

the validation goes in your class file

do you have the functionality where those radio button selections are being stored in a db table, and then saved to a form b/c that is next. i can work on that 2moro.

this code can be displayed on another page that would display/confirm their picks
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
Offline Zero2Cool  
#50 Posted : Sunday, September 20, 2009 8:19:35 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

The picks are predicated on the username already. It takes the global variable from the website. If you were to submit picks, it'd register as YOUR username :)

UserPostedImage
Click here and find the LATEST Packers News!
Offline dhpackr  
#51 Posted : Sunday, September 20, 2009 8:22:39 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

Originally Posted by: " Go to Quoted Post
The picks are predicated on the username already. It takes the global variable from the website. If you were to submit picks, it'd register as YOUR username :)


perfect, can u submit the picks, are the picks being stored in a db table, then retrieved from the db and displayed on a page based on memberid or username?

add the code i gave you to your file

change
&lt;input name='rdoGame01' type='radio' value='Titans' /&gt;Tenneesee Titans
&lt;input name='rdoGame01' type='radio' value='Steelers'/&gt;Pittsburgh

with...................................................................................................

&lt;?php
&lt;input type="radio" name="rdoGame01" value="1" class="textbox"&lt;?if($rdoGame01=="1"){echo " checked ";}?&gt;>Tenneesee Titans

&lt;input type="radio" name="rdoGame01" value="0" class="textbox"&lt;?if($rdoGame01=="0"){echo " checked ";}?&gt;> Steelers
?>
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
Offline Zero2Cool  
#52 Posted : Sunday, September 20, 2009 8:30:01 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

Originally Posted by: " Go to Quoted Post
Originally Posted by: " Go to Quoted Post
The picks are predicated on the username already. It takes the global variable from the website. If you were to submit picks, it'd register as YOUR username :)


perfect, can u submit the picks, are the picks being stored in a db table, then retrieved from the db and displayed on a page based on memberid or username?


Yes sir. I'm using the username from the main website's db and using a separate db to store the picks. The picks are also retrieved from that location based on the username.

So if I were to submit my picks logged in as SlickVision and then next week as Zero2Cool, I'd be fux0red. :)

UserPostedImage
Click here and find the LATEST Packers News!
Offline dhpackr  
#53 Posted : Sunday, September 20, 2009 8:45:19 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

Originally Posted by: " Go to Quoted Post
Originally Posted by: " Go to Quoted Post
Originally Posted by: " Go to Quoted Post
The picks are predicated on the username already. It takes the global variable from the website. If you were to submit picks, it'd register as YOUR username :)


perfect, can u submit the picks, are the picks being stored in a db table, then retrieved from the db and displayed on a page based on memberid or username?


Yes sir. I'm using the username from the main website's db and using a separate db to store the picks. The picks are also retrieved from that location based on the username.

So if I were to submit my picks logged in as SlickVision and then next week as Zero2Cool, I'd be fux0red. :)


look at post above this one^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
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
Offline dhpackr  
#54 Posted : Sunday, September 20, 2009 8:50:44 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

now there is no code in that file u sent to connect to db or retrieve data from db and display on form.

that is not a dynamic database driven form
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
Offline Zero2Cool  
#55 Posted : Sunday, September 20, 2009 8:50:53 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

Okay, how does it get checked? Is that code have some hidden magic I don't see in the code or does it need to be validated elsewhere? In short, how does it validate? lol

UserPostedImage
Click here and find the LATEST Packers News!
Offline dhpackr  
#56 Posted : Sunday, September 20, 2009 8:56:57 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

here is validation

function check_pick() {
//if (Auth::isAdmin())

//return true;
this chunck of code allows admin to
bypass validation remove the slashes to make it so admin would have to check all boxes


$is_valid = true;
if($this->rdoGame01=="" or $this->rdoGame02=="" ){
$is_valid=false;
$this->add_error('Make a selection!');
}
return $is_valid;

}

this validates the first two radio buttons

in other words....
if rdoGame1 is equal to nothing or =="" then display this error

make a selection

if rdoGameo1 == true then submit

you would have to add 16 variables to this function
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
Offline Zero2Cool  
#57 Posted : Sunday, September 20, 2009 9:17:11 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

I don't know if I have a case of the stupids or what, but that doesn't make much sense. I'm guessing the function will return a value of false if not all games are selected?

UserPostedImage
Click here and find the LATEST Packers News!
Offline dhpackr  
#58 Posted : Sunday, September 20, 2009 9:18:44 PM(UTC)
dhpackr

Rank: 4th Round Draft Pick

Posts: 963
Joined: 12/12/2007(UTC)

Applause Given: 36
Applause Received: 36

Originally Posted by: " Go to Quoted Post
I don't know if I have a case of the stupids or what, but that doesn't make much sense. I'm guessing the function will return a value of false if not all games are selected?


yes and spit that error. but that is just code for two buttons, you need to add code for all 16
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
Offline Zero2Cool  
#59 Posted : Sunday, September 20, 2009 9:25:24 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

Originally Posted by: " Go to Quoted Post
Originally Posted by: " Go to Quoted Post
I don't know if I have a case of the stupids or what, but that doesn't make much sense. I'm guessing the function will return a value of false if not all games are selected?


yes and spit that error. but that is just code for two buttons, you need to add code for all 16


I'll play around with it a little bit and see what happens.

Originally Posted by: " Go to Quoted Post
now there is no code in that file u sent to connect to db or retrieve data from db and display on form.

that is not a dynamic database driven form


I didn't think it was wise to put the database connection information in every thread so I have it in a separate file and am using a function to call it.

UserPostedImage
Click here and find the LATEST Packers News!
Offline Zero2Cool  
#60 Posted : Sunday, September 20, 2009 10:32:37 PM(UTC)
Zero2Cool

Rank: Legend

Yahoo! Fantasy Football - Gold: 2009FleaFlicker Fantasy Football - Silver: 2010Yahoo! NCAA March Madness - Silver: 2011ESPN NCAA March Madness - Bronze: 2010Yahoo! NCAA March Madness - Bronze: 2013

United States
Posts: 25,635
Joined: 10/13/2006(UTC)
Location: Green Bay, WI

Applause Given: 1,835
Applause Received: 1,991

[php]
function check_pick() {
//if (Auth::isAdmin())

//return true;
this chunck of code allows admin to
bypass validation remove the slashes to make it so admin would have to check all boxes


$is_valid = true;
if($this->rdoGame01=="" or $this->rdoGame02=="" ){
$is_valid=false;
$this->add_error('Make a selection!');
}
return $is_valid;

}
[/php]

UserPostedImage
Click here and find the LATEST Packers News!
Rss Feed 
Users browsing this topic
Guest (2)
7 Pages«<23456>»
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.

Notification

Icon
Error



Recent Topics
2h / Green Bay Packers Talk / StarrMax1

4h / Green Bay Packers Talk / uffda udfa

4h / Green Bay Packers Talk / uffda udfa

8h / Green Bay Packers Talk / uffda udfa

10h / Green Bay Packers Talk / DarkaneRules

12h / Green Bay Packers Talk / earthquake

12h / Green Bay Packers Talk / sschind

14h / Around The NFL / Zero2Cool

23h / Green Bay Packers Talk / MintBaconDrivel

24-Jul / Green Bay Packers Talk / dfosterf

24-Jul / Green Bay Packers Talk / porky88

24-Jul / Green Bay Packers Talk / packman82

24-Jul / Green Bay Packers Talk / musccy

24-Jul / Random Babble / wpr

24-Jul / Green Bay Packers Talk / wpr


Tweeter

Copyright © 2006-2014 PackersHome.com™. All Rights Reserved.