All pastes #525777 Raw Edit

Mine

public text v1 · immutable
#525777 ·published 2007-05-31 14:39 UTC
rendered paste body
See the results of this script at http://www.paladine.org.uk/test.php

<?
include("www/db_connect.php");

if($_POST['menu'])
	{
		print("
			Selected list item = ".$_POST['menu']
		);
		
	} else {
		$i = 0;
		$menu_array = array(array());
		mysql_select_db($dbname,$connection);
		$query = "SELECT * FROM $tablename ORDER BY menu_position ASC";
		$get_menu_positions = mysql_query($query);
		if($get_menu_positions)
		{
			while($row = mysql_fetch_assoc($get_menu_positions))
			{
				$menu_id = $row['menu_id'];
				$menu_position = $row['menu_position'];
				$menu_name = $row['menu_name'];
				if($menu_position != 0)
				{
					$menu_array[$i][0] = $menu_id;
					$menu_array[$i][1] = $menu_position;
					$menu_array[$i][2] = $menu_name;
					$i++;
				}
			}
			print("
					<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">
					<select name=\"menu\" size=\"5\">
			");
			for ($l = 0; $l < $i; $l++)
			{
				print("
					<option>".$menu_array[$l][2]."</option>"
 					);
			}
			print("
					</select>
					<br /> 
					<p align=\"left\">
						<input value=\"Test this form\" type=\"submit\">
					</p>
					</form>
			");
		}
	}
?>