I'm having some troubled with my file below. I guess my to the point question is, why at the bottom of my php, doesn't $par1 echo a value? $sql = "SELECT location FROM snag_score_cards WHERE user_id = $user_id"; $result = mysql_query($sql); $selected_id = isset($_POST['location']) ? intval($_POST['location']) : false; $who = ''; $options = ''; while ($row=mysql_fetch_array($result)) { if($selected_id==$row['location']) { $selected = ' selected="selected"'; } else { $selected = ''; } $options .= "<option value=\"{$row['location']}\"{$selected}>{$row['location']}</option>\n"; } ?> <form method="post" action="<?php echo $PHP_SELF;?>"> <select name="location"><option value="">Select Scorecard</option><?php echo $options ?></select> <input type="submit" value="Submit"></form> <?php $user_id = 7; $location = $_POST['location']; "<br/>"; echo "<h1>". $location . "<h1/>"; $sql = "SELECT par1, par2, par3, par3, par5, par6, par7, par8, pa9 FROM snag_score_cards WHERE location = $location"; $result = mysql_query($sql); $_POST['par2']; $_POST['par3']; $_POST['par4']; $_POST['par5']; $_POST['par6']; $_POST['par7']; $_POST['par8']; $_POST['par9']; $par1 = $_POST['par1']; echo $par1; ?> PHP:
Uhm... where are you even setting it? What's the form that's being submit for your $_POST values to be set? Why are you calling all those $_POST indexes without doing anything with them?!? You've got gibberish there, what are you even trying to accomplish?!? Are you under the weird misconception that your $_POST values are set by the query, because they aren't... I THINK what you are trying to do is something more like this: <?php $result = mysql_query(" SELECT par1, par2, par3, par3, par5, par6, par7, par8, pa9 FROM snag_score_cards WHERE location = $location "; $row = mysql_fetch_row($result); $par1 = $row['par1']; echo $par1; ?> Code (markup): But I'm really guessing wildly here... Oh, NOT that you should be using mysql_ statements (hence the big red warning box about not using them in the PHP docs), sending $_POST data to a query without sanitization, etc, etc, etc...