NEW #41
Avatar
dhpackr Registered
Joined: Dec 12, 2007
Posts: 963
Avatar
dhpackr
Registered
Joined:Dec 12, 2007
Posts:963
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
0
SlickVision, Methodikal, Kevin and 5 others
NEW #42
Avatar
Zero2Cool Elite Member
Joined: Oct 14, 2006
Posts: 44,952
Avatar
Zero2Cool
Elite Member
Joined:Oct 14, 2006
Posts:44,952
I won't have it before hand, lol. :)
0
SlickVision, Methodikal, Kevin and 5 others
NEW #43
Avatar
zombieslayer Registered
Joined: Aug 07, 2008
Posts: 9,919
Avatar
zombieslayer
Registered
Joined:Aug 07, 2008
Posts:9,919
"Zero2Cool"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.
0
SlickVision, Methodikal, Kevin and 5 others
NEW #44
Avatar
dhpackr Registered
Joined: Dec 12, 2007
Posts: 963
Avatar
dhpackr
Registered
Joined:Dec 12, 2007
Posts:963
"zombieslayer"
"Zero2Cool"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
0
SlickVision, Methodikal, Kevin and 5 others
NEW #45
Avatar
Zero2Cool Elite Member
Joined: Oct 14, 2006
Posts: 44,952
Avatar
Zero2Cool
Elite Member
Joined:Oct 14, 2006
Posts:44,952
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.
0
SlickVision, Methodikal, Kevin and 5 others
NEW #46
Avatar
dhpackr Registered
Joined: Dec 12, 2007
Posts: 963
Avatar
dhpackr
Registered
Joined:Dec 12, 2007
Posts:963
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
<tr>

<td >Your Pick<font color=red>*</font>:</td>
<td>

<input type="radio" name="dhpackr" value="1" class="textbox"<?if($dhpackr=="1"){echo " checked ;}?>> Packers<br>

<input type="radio" name="dhpackr" value="0" class="textbox"<?if($dhpackr=="0"){echo " checked ";}?>> Bengals


</td>



</tr>

<?---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->dhpackr==""){
$is_valid=false;
$this->add_error('Make a selection!');
}
return $is_valid;

}

this project would take some serous maintanence
0
SlickVision, Methodikal, Kevin and 5 others
NEW #47
Avatar
dhpackr Registered
Joined: Dec 12, 2007
Posts: 963
Avatar
dhpackr
Registered
Joined:Dec 12, 2007
Posts:963
i see some of ur errors now. if i could see the code i think i could make some progress
0
SlickVision, Methodikal, Kevin and 5 others
NEW #48
Avatar
Zero2Cool Elite Member
Joined: Oct 14, 2006
Posts: 44,952
Avatar
Zero2Cool
Elite Member
Joined:Oct 14, 2006
Posts:44,952
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?
0
SlickVision, Methodikal, Kevin and 5 others
NEW #49
Avatar
dhpackr Registered
Joined: Dec 12, 2007
Posts: 963
Avatar
dhpackr
Registered
Joined:Dec 12, 2007
Posts:963
"Zero2Cool"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
<tr>
<td >Pick1<font color=red>*</font>:</td>
<td>
<input type="radio" name="Pick1" value="1" class="textbox"<?if($Pick1=="1"){echo " checked ;}?>> Packers<br>
<input type="radio" name="Pick1" value="0" class="textbox"<?if($Pick1=="0"){echo " checked ";}?>> Bengals

</td>

</tr>


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

</td>

</tr>
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
0
SlickVision, Methodikal, Kevin and 5 others
NEW #50
Avatar
Zero2Cool Elite Member
Joined: Oct 14, 2006
Posts: 44,952
Avatar
Zero2Cool
Elite Member
Joined:Oct 14, 2006
Posts:44,952
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 :)
0
SlickVision, Methodikal, Kevin and 5 others