while ( $row = mysql_fetch_row($result) ) { $premonth = $_POST['month']; switch ( $premonth ){ case $row[0]: header("location: http://xyzu.org/blog.php?month=$row[0]"); break; } }