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
rabidgopher04 (9h) : Coincidentally when I saw the Red Sox in Boston it was against the Brewers.
wpr (17-Aug) : Good idea Z.
wpr (17-Aug) : I tapped my savings to spend time with my son.
Zero2Cool (17-Aug) : I'll have to find a time when Brewers play Red Sox at Fenway. Both teams, one location!
wpr (17-Aug) : Why do you need to be a jerk? I live in a modest home. My kids are out of the house. My wife and I both work. My son paid for most of it. I
Smokey (17-Aug) : Yes, Insurance Agents do well . You must feel so superior .
rabidgopher04 (17-Aug) : Fenway is electric. Great place to watch baseball. I've been a couple times.
wpr (17-Aug) : A few have it already. Most have to save it to do things.
wpr (17-Aug) : Yes Smokey, life takes money to do anything.
Smokey (16-Aug) : IF THEY HAVE THE MONEY !
wpr (16-Aug) : It is a must for everyone.
Zero2Cool (16-Aug) : I gotta hit that place sometime. Red Sox fan. Hell as a Baseball fan you gotta see Fenway.
wpr (16-Aug) : Flew into Boston today. Took in a game at Fenway with my son.
Smokey (15-Aug) : JOIN PACKERSHOME , A GREAT PLACE TO POST !
beast (12-Aug) : Fairly good news on all the injuries other than having the concussions, but glad it wasn't worse.
buckeyepackfan (11-Aug) : stupid Zeke!!!
Zero2Cool (11-Aug) : De'Angelo Yancey said when he saw Malachi Dupre this afternoon "it was like he never even got hit."
DarkaneRules (11-Aug) : Trubisky lit it up last night. he was throwing darts, especially on the run. impressive
DarkaneRules (11-Aug) : evans had a good game otherwise but refs were rusty
DarkaneRules (11-Aug) : wish there wasn't such an obvious block in the back on the punt td
Tezzy (10-Aug) : Go Pack Go!
buckeyepackfan (10-Aug) : Will The Rivers run deep tonight? Only time will tell!?
Smokey (9-Aug) : GB vs Philly , "Chat" will be "Open" .
Porforis (9-Aug) : Shh... Kids these days like cookies...
Smokey (9-Aug) : and Polls !
Porforis (8-Aug) : We have cookies.
Smokey (7-Aug) : COME JOIN OUR FORUM !
Smokey (7-Aug) : JOIN NOW , JOIN TODAY !
Zero2Cool (7-Aug) : Davon House sits out of the Packers’ Monday practice with a hamstring injury
DarkaneRules (7-Aug) : House not in pads today. Hope to hear "we're just being cautious with him" later
Cheesey (7-Aug) : Good time to get th FG misses in, when it doesn't count.
Smokey (6-Aug) : M. Crosby , will be ok
DarkaneRules (6-Aug) : 6 missed field goals. that will be your headline because media
Smokey (6-Aug) : now I have
Smokey (6-Aug) : Have not seen Jamal Williams (RB) .
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
10h / Green Bay Packers Talk / wpr

11h / Green Bay Packers Talk / beast

12h / Green Bay Packers Talk / nerdmann

15h / Green Bay Packers Talk / yooperfan

17-Aug / Green Bay Packers Talk / wpr

17-Aug / Green Bay Packers Talk / Smokey

16-Aug / Green Bay Packers Talk / gbguy20

16-Aug / Green Bay Packers Talk / uffda udfa

16-Aug / Green Bay Packers Talk / DarkaneRules

16-Aug / Green Bay Packers Talk / Zero2Cool

15-Aug / Green Bay Packers Talk / yooperfan

15-Aug / Green Bay Packers Talk / wpr

13-Aug / Green Bay Packers Talk / rabidgopher04

11-Aug / Green Bay Packers Talk / wpr

10-Aug / Green Bay Packers Talk / DarkaneRules

Headlines