Discussion Board
Welcome Guest! You can login or register. Login or Register.
5 Pages<12345>

Options
Go to last post Go to first unread
dhpackr  
#41 Posted : Sunday, September 20, 2009 1:53:01 PM(UTC)
first, you need to write a validation function to ensure each radio button has been selected.

you have given each radio button its own variable in the database?? right.

its game time, and i am drinkin and eatin tacos.

after the game i may do some fishin.

Monday, when i get some time, i'll post some code for radio buttons, validation, and mysql.

unless you get it before hand.

go packers
Zero2Cool  
#42 Posted : Sunday, September 20, 2009 1:56:38 PM(UTC)
I won't have it before hand, lol. :)
zombieslayer  
#43 Posted : Sunday, September 20, 2009 3:42:26 PM(UTC)
" said: Go to Quoted Post
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.asp

lol


Zero - If you were here in SF, you could get pretty good jobs knowing PHP pretty well. ASP not so much.
dhpackr  
#44 Posted : Sunday, September 20, 2009 3:47:16 PM(UTC)
" said: Go to Quoted Post
" said: Go to Quoted Post
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.asp

lol


Zero - If you were here in SF, you could get pretty good jobs knowing PHP pretty well. ASP not so much.


PHP ASP both scripting languages. I could work on apllications in San Fran from WI
Zero2Cool  
#45 Posted : Sunday, September 20, 2009 3:52:11 PM(UTC)
When submit clicked, check all games to ensure a selection has been made, if all selected, send each selection to database, if one or more was missing, indicate that to the user.

once all are sent, I'd like it to say

Zero2Coo's Winners for Week 01
Packers
Lions
etc


That's what I'm going for.
dhpackr  
#46 Posted : Sunday, September 20, 2009 3:53:46 PM(UTC)
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
dhpackr  
#47 Posted : Sunday, September 20, 2009 6:57:13 PM(UTC)
i see some of ur errors now. if i could see the code i think i could make some progress
Zero2Cool  
#48 Posted : Sunday, September 20, 2009 7:40:59 PM(UTC)
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?
dhpackr  
#49 Posted : Sunday, September 20, 2009 8:13:58 PM(UTC)
" said: 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
Zero2Cool  
#50 Posted : Sunday, September 20, 2009 8:19:35 PM(UTC)
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 :)
dhpackr  
#51 Posted : Sunday, September 20, 2009 8:22:39 PM(UTC)
" said: 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
?>
Zero2Cool  
#52 Posted : Sunday, September 20, 2009 8:30:01 PM(UTC)
" said: Go to Quoted Post
" said: 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. :)
dhpackr  
#53 Posted : Sunday, September 20, 2009 8:45:19 PM(UTC)
" said: Go to Quoted Post
" said: Go to Quoted Post
" said: 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^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
dhpackr  
#54 Posted : Sunday, September 20, 2009 8:50:44 PM(UTC)
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
Zero2Cool  
#55 Posted : Sunday, September 20, 2009 8:50:53 PM(UTC)
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
dhpackr  
#56 Posted : Sunday, September 20, 2009 8:56:57 PM(UTC)
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
Zero2Cool  
#57 Posted : Sunday, September 20, 2009 9:17:11 PM(UTC)
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?
dhpackr  
#58 Posted : Sunday, September 20, 2009 9:18:44 PM(UTC)
" said: 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
Zero2Cool  
#59 Posted : Sunday, September 20, 2009 9:25:24 PM(UTC)
" said: Go to Quoted Post
" said: 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.

" said: 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.
Zero2Cool  
#60 Posted : Sunday, September 20, 2009 10:32:37 PM(UTC)
[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]
Rss Feed
Users browsing this topic
Guest
5 Pages<12345>
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

Fan Shout
Zero2Cool (5h) : I've read there limited high end talent but a lot of good talent. I dunno. I'm not bummed though. Unless we take QB or K or P next lol
DarkaneRules (5h) : well it's not deep at QB, hence why so many people are trading up for one
Zero2Cool (5h) : We're gonna be trading back again. This is exciting! Great strategy if draft is as deep as we're being told.
DarkaneRules (5h) : that moment will always be justin harrell for me
Pack93z (5h) : I can honestly say, that might be the most disappointing moment under Ted Thompson, and impact edge player there, from Wisconsin, and they p
DarkaneRules (8h) : hopefully they move back again. keep gettin' them picks
Smokey (15h) : Nothing motivates a player like dropping from the 1st round and loosing 1st round money. GB's 1st second round pick will be ever so thrilled
Cheesey (16h) : Dang..watched for 3 1/2 hours for THAT?!?
Smokey (20h) : Zero your on the clock ; CHAT THE DRAFT ?
dhazer (23h) : you mean a show that teams improve them selves and we wait all night for our pick and TT trades back lol
Zero2Cool (27-Apr) : NFL Draft is tonight, right?
Tezzy (27-Apr) : \_/ Smokey!
Smokey (26-Apr) : \_/ Tezzy
Tezzy (26-Apr) : I feel we are on the cusp of a special time of Packers football. My optimism for the rest of the 2000-teens is strong.
Tezzy (26-Apr) : Sign Cutler and draft a QB in round 1. Go Pack Go!!!!
TheKanataThrilla (25-Apr) : I will be there with beer in hand.
Smokey (25-Apr) : CHAT and Draft Thursday night in the PACKERSHOME CHAT ROOM ! Don't forget the cold beer .
TheKanataThrilla (21-Apr) : Seattle at Pack week 1. Hopefully Aaron gets some reps this preseason.
TheKanataThrilla (20-Apr) : Ruben Foster tests positive for weed. Any chance he falls to us? Probably not.
Smokey (20-Apr) : Thanks wpr, I'll order a L.Pizza !
wpr (20-Apr) : Smokey the chat room has been available for prior drafts
Smokey (20-Apr) : Great News , Zero . Also will the "Chat" room be up and operating for the 1st round of the NFL Draft ?
Zero2Cool (20-Apr) : Packers schedule coming out today, 7pm CST
Zero2Cool (19-Apr) : Fans should care about Dean Blandino’s departure from the NFL because it matters…a lot http://ble.ac/2osxh74
Zero2Cool (19-Apr) : Aaron Hernandez found dead in prison cell
Tezzy (18-Apr) : That stat line of 142 of 144 regular season games
Zero2Cool (18-Apr) : A.J. Hawk will retire with the @packers after recording the most tackles in franchise history (1,118)
Smokey (14-Apr) : Hernandez already convicted of previous two murders .
Smokey (14-Apr) : Aaron Hermandez found Not Guilty of Murder Charges .
Smokey (11-Apr) : Packers will play the Eagles , Redskins , Broncos , and Rams in Preseason 2017 .
Zero2Cool (11-Apr) : Odd to see GM John Lynch .. I won't get used to that for a while haha
Cheesey (10-Apr) : I don't think she has anything to do with how he plays on the field.
Porforis (7-Apr) : 100% conjecture but maybe they've been on the rocks and that contributed to his long slump?
Zero2Cool (7-Apr) : Aaron Rodgers and actress Olivia Munn break up, People magazine reports. Here we go
Porforis (7-Apr) : Forum needs some FOOTBAH! l.
Please sign in to use Fan Shout
2017 Packers Schedule
Sunday, Sep 10 @ 3:25 PM
SEAHAWKS
Sunday, Sep 17 @ 7:30 PM
at Falcons
Sunday, Sep 24 @ 3:25 PM
BENGALS
Thursday, Sep 28 @ 7:25 PM
BEARS
Sunday, Oct 8 @ 3:25 PM
at Cowboys
Sunday, Oct 15 @ 12:00 PM
at Vikings
Sunday, Oct 22 @ 12:00 PM
SAINTS
Sunday, Oct 29 @ 12:00 AM
- BYE -
Monday, Nov 6 @ 7:30 PM
LIONS
Sunday, Nov 12 @ 12:00 PM
at Bears
Sunday, Nov 19 @ 12:00 PM
RAVENS
Sunday, Nov 26 @ 7:30 PM
at Steelers
Sunday, Dec 3 @ 12:00 PM
BUCCANEERS
Sunday, Dec 10 @ 12:00 PM
at Browns
Saturday, Dec 23 @ 7:30 PM
VIKINGS
Sunday, Dec 31 @ 12:00 PM
at Lions
Saturday, Dec 17 @ 12:00 PM
at Panthers
Think About It
Think About It
Recent Topics
46m / Green Bay Packers Talk / Yerko

1h / Green Bay Packers Talk / wpr

4h / Green Bay Packers Talk / PackFanWithTwins

4h / Green Bay Packers Talk / wpr

4h / Green Bay Packers Talk / wpr

16h / Green Bay Packers Talk / FLORIDA PACKER88

27-Apr / Green Bay Packers Talk / nerdmann

26-Apr / Green Bay Packers Talk / wpr

26-Apr / Green Bay Packers Talk / wpr

26-Apr / Green Bay Packers Talk / Tezzy

25-Apr / Green Bay Packers Talk / PackFanWithTwins

24-Apr / Green Bay Packers Talk / PackFanWithTwins

24-Apr / Green Bay Packers Talk / PackFanWithTwins

22-Apr / Green Bay Packers Talk / Zero2Cool

20-Apr / Around The NFL / Smokey

Headlines