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