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
Smokey (1h) : Chief Salad Day !
Smokey (24-Jun) : Guest ? Join us Today !
Smokey (24-Jun) : Saturday , it's PIZZA NIGHT !
Smokey (23-Jun) : Friday is Seafood day , not Pizza night . Eat a Shrimp !
Cheesey (23-Jun) : Happy B-day rocker!
Zero2Cool (22-Jun) : Today's Birthdays: hardrocker950 (33)
Smokey (22-Jun) : Coffee anyone ?
Smokey (21-Jun) : good show
Cheesey (21-Jun) : APPLE with ice cream!
Smokey (20-Jun) : Cherry with Vanilla Ice Cream !!
Cheesey (20-Jun) : APPLE!
Smokey (20-Jun) : Apple or Cherry Pie ?
TheKanataThrilla (18-Jun) : The only have 2 preseason games. I like that as the fans get to see more of the starters.
TheKanataThrilla (18-Jun) : Next week I believe the CFL season starts. Go Redblacks!!!
Smokey (18-Jun) : Been researching CFL , Edmonton Eskimos have the best colors/uniforms .
Smokey (18-Jun) : When does the CFL Season start anyway ?
Smokey (18-Jun) : Saw Flute CFL highlights in the day, full CFL game was /is rare .
TheKanataThrilla (18-Jun) : I wish many of you would have seen Doug Flutie in the CFL. Absolute beauty.
TheKanataThrilla (18-Jun) : Vince Young cut from Sask. Roughriders. Good for him to consider the CFL, but only a select few NFL QB castoffs are a good CFL fit.
Smokey (17-Jun) : R 2
Zero2Cool (17-Jun) : Not all hackers are bad
Smokey (16-Jun) : Public Hangings for Hackers .
Cheesey (16-Jun) : No, he said HACKERS!
Smokey (16-Jun) : Did you say Crackers ?
Zero2Cool (16-Jun) : PACKERS PACKERS PACKERS
Cheesey (16-Jun) : "That is true, my dear Smokey!"LOL!
Smokey (15-Jun) : dat ? Brer Cheesey ?
Cheesey (15-Jun) : True dat, Smokey. MUCH better!
Smokey (15-Jun) : I like the fillets/tenders, they usually are a better deal.
Cheesey (15-Jun) : Good one, Porforis! Made me laugh!
Porforis (15-Jun) : Shoulda gone with Kentucky Fried Chickadee
Cheesey (15-Jun) : Last time I had KFC, the pieces were so small it should be renamed "Kentucky Fried Sparrow"
Cheesey (15-Jun) : POPEYES! (Or Churches chicken)
Smokey (15-Jun) : KFC or Popeyes Chicken ?
Smokey (15-Jun) : It's grocery shopping day !
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
3m / Green Bay Packers Talk / beast

7m / Green Bay Packers Talk / Smokey

15h / Green Bay Packers Talk / beast

17h / Green Bay Packers Talk / steveishere

25-Jun / Around The NFL / Smokey

25-Jun / Football Familiarity / Smokey

25-Jun / Green Bay Packers Talk / beast

24-Jun / Green Bay Packers Talk / beast

24-Jun / Green Bay Packers Talk / beast

24-Jun / Green Bay Packers Talk / beast

24-Jun / Green Bay Packers Talk / isocleas2

24-Jun / Around The NFL / beast

23-Jun / Green Bay Packers Talk / beast

23-Jun / Green Bay Packers Talk / sschind

23-Jun / Green Bay Packers Talk / sschind

Headlines