Jump to content

<select> help


fabiez

Recommended Posts

ok here's my problem $Sql1 returns two values: 8 and 10 and these numbers get put into a <select>. So far so good. I assign a onchange to it. When i select 8 it makes the changes but when I select 10 nothing happends. I preciate some help.

 

<?php
require("status.php");
require("id.php");

$Link = mysql_connect($Host, $User, $Password);
mysql_select_db('sportsportal', $Link);

$Sql1 = "select distinct week, (select max(week) from coupons where user='$User') max from coupons where user='$User'";
$Result1 = mysql_query($Sql1, $Link);

print "<tr>";
print "<td align=left valign=top>     </td>";
print "<td align=left valign=top>";

print "<select name=current_week onchange=window.location='coupon.php?curwk='+this.value>";
while($Row1 = mysql_fetch_array($Result1)){

//if($Row1[week] == $Row1[max]){
//print "<option value='$Row1[week]' selected>Vecka $Row1[week]</option>";
//} else {
//print "<option value='$Row1[week]'>Vecka $Row1[week]</option>";
//}

print "<option value='$Row1[week]'>Vecka $Row1[week]</option>";

}
print "</select>";

print "<p></td>";
print "</tr>";

if(isset($_REQUEST['curwk'])){
$Curwk = $_REQUEST['curwk'];
} else {
$Curwk = 0;
}

$Sql = "select home, away, home_score, away_score, winner from coupons where user='$User' and week='$Curwk'";
$Result = mysql_query($Sql, $Link) or die(mysql_error());

while($Row = mysql_fetch_array($Result)){

if(@$Row[home] == @$Row[winner]){
print "<tr>";
print "<td align=left valign=top>     </td>";
print "<td align=left valign=top><b>$Row[home]</b> - $Row[away] $Row[home_score]-$Row[away_score]</td>";
print "</tr>";
} else {
print "<tr>";
print "<td align=left valign=top>     </td>";
print "<td align=left valign=top>$Row[home] - <b>$Row[away]</b> $Row[home_score]-$Row[away_score]</td>";
print "</tr>";
}

}

mysql_close($Link);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.