dhpackr
15 years ago
try using the code i posted for a drop down list
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
15 years ago

try using the code i posted for a drop down list

"dhpackr" wrote:



I tried, but it's over my head. I don't understand the variables. They have no real meaning. i, i02? That's confusing to simple minded folk like me. Remember, I'm a VB programmer, I need pictures!!! lol


Drop Down List won't work too great. If you scroll you could inadvertently select a different team. That's why I went with radio buttons.
UserPostedImage
dhpackr
15 years ago



I don't understand the variables. They have no real meaning. i, i02? That's confusing to simple minded folk like me. Remember, I'm a VB programmer, I need pictures!!! lol


Drop Down List won't work too great. If you scroll you could inadvertently select a different team. That's why I went with radio buttons.

"Zero2Cool" wrote:



remember, if u choose a radio button, all that will show up in ur database is a 1 or 0

let's break this down
***********************************************************
1st pick a drop down list where the user either picks packers or bengals
<?-----start php script

$01s = array("Packers","Bengals"); //here i am populating an array
//this is an array for a game.
//only two teams in this list are the packers and bengals
if (empty($01s[0])) {
echo '<input type="text" name="01" class="textbox" value="' . $01. '" maxlength="255" />' . "\n";
}
else {
?>
<select name="01" class="textbox">
<option value="">-- please select --</option>
<?
// Print out position options
for ($i = 0; $i < count($01s); $i++) {
echo '<option value="' . $01s[$i] . '"';
if($01s[$i]==$01){echo " selected ";}
echo ">" . $01s[$i] . "</option> \n";
}
?>

************************************************************

2nd pick a drop down list where the user either picks Vikings or Lions
<?-----start php script

$02s = array("Vikings","Lions"); //here i am populating an array
//this is an array for a different game.
//only two teams in this list are the Vikings and lions
if (empty($02s[0])) {
echo '<input type="text" name="02" class="textbox" value="' . $02. '" maxlength="255" />' . "\n";
}
else {
?>
<select name="02" class="textbox">
<option value="">-- please select --</option>
<?
// Print out position options
for ($i = 0; $i < count($02s); $i++) {
echo '<option value="' . $02s[$i] . '"';
if($02s[$i]==$02){echo " selected ";}
echo ">" . $02s[$i] . "</option> \n";
}
?>

*************************************************************
so now i have two drop down lists for two different games. this code will go into my template file. it doesn't matter what u call the variable. I used 01 and 02, you can use whatever you wish.

*************************************************************
now you want to write a function to add picks to database
function add_pick(memberid,$01=null,$02=null) {
$id = $this->get_new_id();
$values = array (
$this->memberid(), $this->01 = $01;
$this->02 = $02;
);

$query = 'INSERT INTO ' . $this->get_table('whateverthetableis') . ' VALUES(?, ?,?)';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, $values);
$this->check_for_error($result);

unset($values, $query);
return $id;
}
*************************************************************

modify the picks

function mod_pick() {
$values = array (

$res->get_01(),
$res->get_02()
);

$query = 'UPDATE ' . $this->get_table('whateverthetableis')

. ' 01=?,'
. ' 02=?,'


$q = $this->db->prepare($query);
$result = $this->db->execute($q, $values);
$this->check_for_error($result);

unset($values, $query);
}
*************************************************************
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
15 years ago

remember, if u choose a radio button, all that will show up in ur database is a 1 or 0

"dhpackr" wrote:



[php]
<input name='rdoGame14' type='radio' value='Bears' />Chicago Bears
<input name='rdoGame14' type='radio' value='Packers' />Green Bay Packers
[/php]

That gives me the 'Bears' or 'Packers' for the value instead of 1 or 0. I've wrote the team names to the database.

In fact, if you go to Special Features > NFL Picks > 1 and make some selections and hit submit, it'll go to the database with the team names.

I'm using Week02 as my test dummy for validation. 🙂


[php] //code above scans all rdoGame values ...

$varSelection = array($int => array($x, $strSelection));

$int++;
echo $int . " number. <br>";
}
}
//replace this with a check to see if $int = total games for that week.
//if yes, then use a for each loop through the $varSelection array and send
//each pick to the db, one by one.
/if no, exit and alert user to make all selections.

echo $varSelection[0][0] . " - " . $varSelection[0][1] . "<br>";
echo $varSelection[1][0] . " - " . $varSelection[1][1] . "<br>";
echo $varSelection[2][0] . " - " . $varSelection[2][1] . "<br>";
[/php]


Basically, once I get how to increment a multidimensional array's index dynamically, I could be set to go. I have most of this all written down on how to go about it. Except the incrementation of the index in my array. It's only storing the last set of data instead of an index.
UserPostedImage
Zero2Cool
15 years ago
Woohooo!! I figured it out!! Works like a freaking champ!!

I got the array to increment the element and also figured out how to use the for each array to cycle through each element. w00t!

Now to implement the check for all games selected and finish the template.

POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
UserPostedImage
Rockmolder
15 years ago

Woohooo!! I figured it out!! Works like a freaking champ!!

I got the array to increment the element and also figured out how to use the for each array to cycle through each element. w00t!

Now to implement the check for all games selected and finish the template.

POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER
POW!!! RIGHT IN THE KISSER

"Zero2Cool" wrote:



[youtube]husjA7bfmug[/youtube]

I know, I know. Honeymooners for you old people.
dhpackr
15 years ago
GR8 Job!
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
15 years ago

GR8 Job!

"dhpackr" wrote:



Thanks. Now I'm trying to find my pseudo code on how to tally up the numbers or think of how I was planning on it in the first place. lol
UserPostedImage
wpr
  • wpr
  • Preferred Member
15 years ago

I have no idea what you are talking about, but thanks for keeping this site running!

"IronMan" wrote:



Ditto.
UserPostedImage
dhpackr
15 years ago

GR8 Job!

"Zero2Cool" wrote:



Thanks. Now I'm trying to find my pseudo code on how to tally up the numbers or think of how I was planning on it in the first place. lol

"dhpackr" wrote:



i was wondering about that, i sent you an PM.
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Fan Shout
Zero2Cool (40m) : If you wanna post about the Super Bowl, please, by all means, open a topic. They are free this month! 😁
Zero2Cool (40m) : There doesn't need to be a topic. There's a playoff prediction thread.
packerfanoutwest (48m) : and there no SB contest over in the other Packer forum, either
buckeyepackfan (59m) : #2Officially Retires!
beast (1h) : Probably no SB topic as people are wore out talking about the Chiefs, Refs and Eagles
Zero2Cool (1h) : Packers reportedly have their new LB coach, promoting Sean Duggan to that role
Zero2Cool (5h) : WR Cooper Kupp is being traded.
packerfanoutwest (17h) : why is there no SB Prediction topic?
Zero2Cool (21h) : Anthony Perkins spent 2024 as a defensive quality-control coach with the Packers.
Zero2Cool (21h) : Packers lose another assistant.
Zero2Cool (3-Feb) : Defensive Player of the Year and Browns star Myles Garrett has requested a trade.
Zero2Cool (3-Feb) : deleted all my browser history and autofill and passwords. gonna be fun!
packerfanoutwest (3-Feb) : too funny
packerfanoutwest (3-Feb) : Lions QB Jared Goff was the offensive MVP
packerfanoutwest (3-Feb) : for the Pro Bowl, which is flag football
Zero2Cool (2-Feb) : Rather, the murder WAS covered up to prevent ...
Zero2Cool (2-Feb) : JFK murder was a cover-up to prevent war with Cuba/Russia.
Martha Careful (1-Feb) : I have always admired the pluck of the man
Zero2Cool (1-Feb) : I remember thinking he was going to be something good.
Mucky Tundra (1-Feb) : The Dualing Banjo!
Zero2Cool (31-Jan) : Jets have named Chris Banjo as their special teams coordinator, Former Packers player
Zero2Cool (31-Jan) : Jaguars have hired Anthony Campanile as their DC. We lose coach
Zero2Cool (30-Jan) : QB coach Sean Mannion
Zero2Cool (30-Jan) : DL Coach DeMarcus Covington
dfosterf (30-Jan) : from ft Belvoir, Quantico and points south. Somber reminder of this tragedy at Reagan Nat Airport
dfosterf (30-Jan) : So eerily quiet here in Alexandria. I live in the flight path of commercial craft coming from the south and west, plus the military craft
dfosterf (30-Jan) : So eeri
Mucky Tundra (30-Jan) : Now that's a thought, maybe they're looking at the college ranks? Maybe not head coaches but DC/assistant DCs with league experience?
beast (30-Jan) : College Coaches wouldn't want that publicly, as it would hurt recruiting and they might not get the job.
beast (30-Jan) : I thought they were supposed to publicly announce them, at least the NFL ones. Hafley was from college, so I believe different rules.
Mucky Tundra (30-Jan) : Who knows who they're interviewing? I mean, nobody knew about Hafley and then out of nowhere he was hired
beast (30-Jan) : I wonder what's taking so long with hiring a DL coach, 2 of the 3 known to interview have already been hired elsewhere.
Zero2Cool (27-Jan) : Packers coach Matt LaFleur hires Luke Getsy as senior assistant, extends Rich Bisaccia's deal
Zero2Cool (27-Jan) : Chiefs again huh? I guess another Super Bowl I'll be finding something else to do.
Mucky Tundra (27-Jan) : Chiefs Eagles...again...sigh
dfosterf (27-Jan) : Happy Birthday Dave!
Mucky Tundra (27-Jan) : happy birthday dhazer
TheKanataThrilla (26-Jan) : Exactly buck...Washington came up with the ball. It is just a shitty coincidence one week later
buckeyepackfan (26-Jan) : I forgot, they corrected the call a week later. Lol btw HAPPY BIRTHDAY dhazer!
buckeyepackfan (26-Jan) : That brings up the question, why wasn't Nixon down by contact? I think that was the point Kanata was making.
buckeyepackfan (26-Jan) : Turnovers rule, win the turnover battle, win the game.
packerfanoutwest (26-Jan) : well, he was
TheKanataThrilla (26-Jan) : Eagles down by contact on the fumble....fuck you NFL
Mucky Tundra (26-Jan) : I think this games over
beast (26-Jan) : Eagles sure get a lot of fumbles on kickoffs
Mucky Tundra (26-Jan) : This game looks too big for Washington
packerfanoutwest (26-Jan) : that being said, The Ravens are the Browns
packerfanoutwest (26-Jan) : Browns, Dolphins have longest AFC Championship droughts
packerfanoutwest (26-Jan) : As of today, Cowboys have longest NFC Championship drought,
beast (26-Jan) : Someone pointed out, with Raiders hiring Carroll, the division games between Carroll and Jim Harbaugh are back on (who can whine more games)
Please sign in to use Fan Shout
2024 Packers Schedule
Friday, Sep 6 @ 7:15 PM
Eagles
Sunday, Sep 15 @ 12:00 PM
COLTS
Sunday, Sep 22 @ 12:00 PM
Titans
Sunday, Sep 29 @ 12:00 PM
VIKINGS
Sunday, Oct 6 @ 3:25 PM
Rams
Sunday, Oct 13 @ 12:00 PM
CARDINALS
Sunday, Oct 20 @ 12:00 PM
TEXANS
Sunday, Oct 27 @ 12:00 PM
Jaguars
Sunday, Nov 3 @ 3:25 PM
LIONS
Sunday, Nov 17 @ 12:00 PM
Bears
Sunday, Nov 24 @ 3:25 PM
49ERS
Thursday, Nov 28 @ 7:20 PM
DOLPHINS
Thursday, Dec 5 @ 7:15 PM
Lions
Sunday, Dec 15 @ 7:20 PM
Seahawks
Monday, Dec 23 @ 7:15 PM
SAINTS
Sunday, Dec 29 @ 3:25 PM
Vikings
Sunday, Jan 5 @ 12:00 PM
BEARS
Sunday, Jan 12 @ 3:30 PM
Eagles
Recent Topics
1h / Green Bay Packers Talk / beast

2h / Green Bay Packers Talk / Martha Careful

3h / Green Bay Packers Talk / beast

4h / Green Bay Packers Talk / Zero2Cool

14h / Green Bay Packers Talk / earthquake

15h / Green Bay Packers Talk / earthquake

1-Feb / Green Bay Packers Talk / Martha Careful

1-Feb / Green Bay Packers Talk / wpr

29-Jan / Green Bay Packers Talk / Mucky Tundra

27-Jan / Green Bay Packers Talk / beast

25-Jan / Green Bay Packers Talk / beast

25-Jan / Green Bay Packers Talk / Martha Careful

25-Jan / Random Babble / Martha Careful

20-Jan / Green Bay Packers Talk / Martha Careful

20-Jan / Green Bay Packers Talk / bboystyle

Headlines
Copyright © 2006 - 2025 PackersHome.com™. All Rights Reserved.