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 (2h) : NFL. Done. 2018 I wait.
hardrocker950 (2h) : Raiders lose due to fumble in the end zone
Zero2Cool (4h) : @zachkruse2 Nick Perry has almost as many injuries (4) as sacks (7) in the first year of his $60M deal. Hand, foot, shoulder and now ankle.
Zero2Cool (5h) : sommbitch ... my game feed crapped out
Zero2Cool (6h) : Allison wasn't going to the ground though.
beast (6h) : Allison fumble, and that touchdown were the same play... either both should be catches or both should be drops
beast (6h) : That's a touchdown! ... he lost control of the ball after crosing the goaline
beast (6h) : He caught the ball and crossed the goaline UNTOUCHED!
dhazer (6h) : well we made the Panthers owner sell the team lol
dhazer (6h) : beast it did not take a touchdown away, by the rule you must maintain control of the ball so he didnt catch the ball so it was not a td
Zero2Cool (6h) : And there it is... Panthers up for sale after end of season
beast (7h) : NFL catch rule screwed the Steelers... took a TD away from them
beast (7h) : Steelers got screwed by the NFL rule...
hardrocker950 (9h) : Antonio Brown injured
TheKanataThrilla (9h) : If this is an incomplete pass in the Seahawks game I am pissed
hardrocker950 (14h) : That number will likely shrink a lot after this weekend
Zero2Cool (14h) : Damarious Randall and Josh Hawkins as the defense's top cornerbacks today.
Zero2Cool (15h) : 24 teams are still alive for playoffs in week 15...
buckeyepackfan (15h) : We have a winner! Zero tell Smokey what he has won! :)
Zero2Cool (16h) : that's the guy who wanted chagne of scenery i suppose
Zero2Cool (16h) : Marvin Lewis’ plans to leave his job as Bengals’ HC after this season
Zero2Cool (16h) : Packers have been using the 4-3 for awhile on defense.
Smokey (16h) : Tears for Fears
buckeyepackfan (16h) : Shout! Shout! Let it all out! Who sang it?
yooperfan (20h) : Game time weather: 48, PC wind sw at 4mph
yooperfan (20h) : "RUN THE TABLE"
yooperfan (20h) : Rise and shine Packers fans!
buckeyepackfan (22h) : THAT BAAAAAAAD MAN IS BACK!
buckeyepackfan (22h) : GAMEDAY! #assesagainstthewall!
buckeyepackfan (22h) : GOOD MORNING PACKER FANS!
Mucky Tundra (17-Dec) : when did Saturday games become a thing again?
gbguy20 (17-Dec) : Fucking game isn't on tv in MN
beast (17-Dec) : Wait, why are you starting Christmas shopping early? ;p
Smokey (17-Dec) : Been there, finished that .
Zero2Cool (17-Dec) : if i were smarter, i would have started Christmas shopping before now'
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
Sunday, Dec 17 @ 12:00 PM
at Panthers
Saturday, Dec 23 @ 7:30 PM
VIKINGS
Sunday, Dec 31 @ 12:00 PM
at Lions
Think About It
Think About It
Recent Topics
16m / Green Bay Packers Talk / beast

2h / Green Bay Packers Talk / sschind

3h / Green Bay Packers Talk / wpr

3h / Green Bay Packers Talk / gbguy20

4h / Green Bay Packers Talk / wpr

6h / Green Bay Packers Talk / beast

8h / Green Bay Packers Talk / nerdmann

9h / Green Bay Packers Talk / yooperfan

9h / Green Bay Packers Talk / yooperfan

9h / Green Bay Packers Talk / rabidgopher04

9h / Green Bay Packers Talk / beast

10h / Green Bay Packers Talk / nerdmann

10h / Green Bay Packers Talk / DarkaneRules

12h / Green Bay Packers Talk / rabidgopher04

13h / Green Bay Packers Talk / Zero2Cool

Headlines