dhpackr
14 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
14 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
14 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
14 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
14 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
14 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
14 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
14 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
14 years ago

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

"IronMan" wrote:



Ditto.
UserPostedImage
dhpackr
14 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
Users browsing this topic
    Fan Shout
    Mucky Tundra (1h) : *sad Mucky noises*
    Mucky Tundra (1h) : @JoeJHoyt Murphy said he’s been told he won’t slide past pick No. 16.
    wpr (8h) : Just about time to watch Sonny Weaver stick it to the seahags. I never get tired of it.
    Martha Careful (8h) : *game plan
    Martha Careful (9h) : IMHO, not even close. He is not a guy you game play around.
    Mucky Tundra (12h) : is Aiyuk worth a 1st rounder?
    Zero2Cool (12h) : 49ers are seeking a 1st round pick in exchange for WR Brandon Aiyuk
    Mucky Tundra (22-Apr) : Based on Gutes comments, now I don't feel as silly having 13 picks in my mock the other day
    Zero2Cool (22-Apr) : Zach Wilson to Broncos.
    Zero2Cool (22-Apr) : Gutekunst says he'd love to have 13 or 14 picks. He's trading back huh lol
    beast (22-Apr) : Someday we'll have a draft betting scandal
    beast (21-Apr) : Sometimes looking extremely amazing, sometimes looking extremely lost
    beast (21-Apr) : I haven't looked into the QBs, but some have suggested Maye has some of the most extremely inconsistent tape they've seen
    beast (21-Apr) : Well it also sounds like Patriots are listening to trade offers, not that seriously considering any, but listening means they aren't locked
    Zero2Cool (21-Apr) : Maye needs to be AFC
    Mucky Tundra (21-Apr) : Not liking the idea of the Vikings getting Maye
    Zero2Cool (21-Apr) : Vikings HC joked that he may or may not have sent flowers to Bob Kraft. That's where rumor came from.
    beast (21-Apr) : Can't tell if this is real or BS, but some rumors about a possible Patriots/Vikings trade for #3 overall
    dfosterf (21-Apr) : One playbook to my knowledge. I was shooting for facetious.
    beast (20-Apr) : I'm not sure they have different playbooks for different OL positions, and Dillard run blocking is supposedly worse than his pass blocking..
    dfosterf (19-Apr) : The only problem with that is he isn't a guard either.
    dfosterf (19-Apr) : Put him at right guard. That is where he will be coached. That is where he will compete. He is not even allowed to look at the LT playbook.
    dfosterf (18-Apr) : Kidding aside, I hope the best for him.
    dfosterf (18-Apr) : Went to a Titans board. One comment there. Not very long. I quote: "LOL" They don't sound overly upset about our aquisition.
    beast (18-Apr) : OT Dillard has been absolutely horrible... like OG Newman levels
    dfosterf (18-Apr) : Suit him up and have him stand in front of the big board as a draft day cautionary tale.
    Zero2Cool (18-Apr) : Packers sign T Andre Dillard.
    Mucky Tundra (18-Apr) : Adds most of the information this time of year comes from agents.
    Mucky Tundra (18-Apr) : @RealAlexBarth Bill Belichick says accurate draft information doesn't leak from teams until about 12 hours before the draft. Adds most of th
    Mucky Tundra (18-Apr) : I am very happy that for moment, Jordan Love seems like a normal human being
    Zero2Cool (17-Apr) : Belichick * whatever
    Zero2Cool (17-Apr) : "There's a lot of depth at Offensive Tackle and Wide Receiver." Bill Bellichick
    Zero2Cool (17-Apr) : Thanks! I can't believe it's over haha
    Martha Careful (16-Apr) : Congratulations
    Zero2Cool (16-Apr) : Boom. Student Loan. $0.00. Only took about 20 years.
    Zero2Cool (14-Apr) : Packers DT Kenny Clark: New defensive coordinator Jeff Hafley will 'allow us to be way more disruptive'
    Zero2Cool (12-Apr) : Saints have agreed to terms on a contract with former Packers wide receiver Equanimeous St. Brown.
    beast (12-Apr) : No, but of it's for legislation, then half of the country will find it evil, not good, whatever it says....
    Mucky Tundra (12-Apr) : Draft is still 2 weeks away. UGH
    dhazer (11-Apr) : Does anyone know of a good AI generator to create letters of Support for legislation?
    Zero2Cool (11-Apr) : Gordon "Red" Batty retires as equipment manager
    Zero2Cool (10-Apr) : Sounds like that's pretty certain now.
    Zero2Cool (10-Apr) : Packers "at" Eagles in Brazil. Week One
    dfosterf (10-Apr) : Va' Fazer As Malas Va' !
    Zero2Cool (9-Apr) : Mark Murphy tipping us off?
    Zero2Cool (9-Apr) : “We’re either the first- or second-most popular team in Brazil.”
    Zero2Cool (9-Apr) : Christian Watson got married. Wife better be careful with those hamstrings!! 😂😂
    dfosterf (9-Apr) : Those poor bastards
    Zero2Cool (8-Apr) : Falcons have signed former Packers CB Kevin King, who has been out of football since 2021.
    dfosterf (8-Apr) : Collectively, we need to spend more time in what we have, when analyzing ostendible needs and historical proclivities
    Please sign in to use Fan Shout
    2023 Packers Schedule
    Sunday, Sep 10 @ 3:25 PM
    Bears
    Sunday, Sep 17 @ 12:00 PM
    Falcons
    Sunday, Sep 24 @ 12:00 PM
    SAINTS
    Thursday, Sep 28 @ 7:15 PM
    LIONS
    Monday, Oct 9 @ 7:15 PM
    Raiders
    Sunday, Oct 22 @ 3:25 PM
    Broncos
    Sunday, Oct 29 @ 12:00 PM
    VIKINGS
    Sunday, Nov 5 @ 12:00 PM
    RAMS
    Sunday, Nov 12 @ 12:00 PM
    Steelers
    Sunday, Nov 19 @ 12:00 PM
    CHARGERS
    Thursday, Nov 23 @ 11:30 AM
    Lions
    Sunday, Dec 3 @ 7:20 PM
    CHIEFS
    Monday, Dec 11 @ 7:15 PM
    Giants
    Sunday, Dec 17 @ 12:00 PM
    BUCCANEERS
    Sunday, Dec 24 @ 12:00 PM
    Panthers
    Sunday, Dec 31 @ 7:20 PM
    Vikings
    Sunday, Jan 7 @ 3:25 PM
    BEARS
    Sunday, Jan 14 @ 3:30 PM
    Cowboys
    Saturday, Jan 20 @ 7:15 PM
    49ers
    Recent Topics
    8h / Green Bay Packers Talk / wpr

    22-Apr / Green Bay Packers Talk / Mucky Tundra

    22-Apr / Green Bay Packers Talk / Mucky Tundra

    21-Apr / Fantasy Sports Talk / dfosterf

    21-Apr / Green Bay Packers Talk / dfosterf

    19-Apr / Random Babble / Zero2Cool

    18-Apr / Green Bay Packers Talk / Zero2Cool

    18-Apr / Random Babble / Mucky Tundra

    18-Apr / Green Bay Packers Talk / Mucky Tundra

    17-Apr / Green Bay Packers Talk / Mucky Tundra

    17-Apr / Green Bay Packers Talk / Mucky Tundra

    17-Apr / Green Bay Packers Talk / beast

    17-Apr / Green Bay Packers Talk / beast

    17-Apr / Green Bay Packers Talk / beast

    16-Apr / Random Babble / Martha Careful

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