Jump to content

Submit from a drop down menu issue


Jay2391

Recommended Posts

I have this code I pick up the drop down menu from a table .... that works when i submit it works the only issue is that every time

i open the page the code resets to "0"  === $atend_id

when i change the option to "3" that will be "present"  and i come back to the page

it refresh to "not present" that is "0"

 

os how do i make this code to happend only and only when the submit option is trigger...

 

     		        $query_atn = "SELECT * FROM $table_atn ORDER BY 'at_id' ASC";
                                  $result_atn = mysql_query($query_atn, $tc); 
						  						  
                                  print "<form action =\"http://localhost/MDO/user_profile.php?user_id=$uname\" method='post'>";
                                  print '<label><select name="at_id">
		    <option value=""></option>';	  
                                         
                                  while($row_atn = mysql_fetch_array($result_atn)){
		$atend_id = $row_atn['at_id'];
		$atend = $row_atn['atend'];
		print "<option value=\"$atend_id\">$atend_id - $atend<br></option>";
																			      				   
                                  }    
		print "</select>"; 
    		            $atend_1 = $_POST['at_id'];
	            echo "<font color='white'> **** </font>";
									   						   
                                  print '<input type="submit" name="submit1" size"20" value="Online Status "/>';
		if ( isset ($_POST['submit1'])){
                                         $problem1 = FALSE;
                          }
	             if (strlen ($_POST['at_id']) >= 2){
	                             $problem1 = TRUE;
		                 print " too much<br>";
	             }
  if(!$problem1){   
    $change1atn = "UPDATE $tabler SET atendance='$atend_1' WHERE (result_id=\"$res_id_atn\")";  
                mysql_query($change1atn) or die ("Cannot Update Table". mysql_error()); 
    $query_atn2 = "SELECT * FROM $table_atn WHERE (at_id=\"$atend_1\")";
    $result_atn2 = mysql_query($query_atn2, $tc); 
               $row_atn2 = mysql_fetch_array($result_atn2);
	    $atend2 = $row_atn2['atend']; 								                  echo "<font color='white'> **** </font>";
	    echo " My Online Status Change to: <font color='green'>$atend2</font><br></h4>";    
}
        }	
    }







Link to comment
https://forums.phpfreaks.com/topic/38660-submit-from-a-drop-down-menu-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.