Jump to content

Smart Drop Down Menu


Recommended Posts

I know this should be made with ajax, but i have no idea from where start.

 

I'd like to show the option "Escola" only if the option "Administrador" or "Moderador" be selected in the option "Status". How can i do that?

 

<?php
session_start();
require_once('includes/auth.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registrar Usuario</title>
<link rel="stylesheet" href="../../css/styles.css" type="text/css">
</head>
<body>
<h1>Registrar Usuario</h1>

<?php
	include("includes/header.php");
?>

<p>Uma senha sera gerada e enviada para o email do usuario.</p>
<form id="loginForm" name="loginForm" method="post" action="../../actions/sadmin_register_user.php">
	<table width="300" border="0" align="left" cellpadding="2" cellspacing="0">
		<tr>
			<th>Status</th>
			<td>
				<select name="school" id="school" > ";
					<option value="1">Super Administrador</option>
					<option value="2">Super Moderador</option>
					<option value="3">Administrador</option>
					<option value="4">Moderador</option>
				</select>
			</td>
		</tr>
		<tr>
			<th>Escola</th>
			<td>

				<?php

				require_once('../../includes/link.php');

				$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

				$query = "SELECT * FROM schools";
				$result = mysql_query($query);

				echo "<select name=\"school\" id=\"school\" > ";

				while($row = mysql_fetch_array($result)) {

				echo "<option value=\"" . $row['id'] . "\">" . $row['name'] . "</option>";

				}

				echo "</select>";

				?>
			</td>
		</tr>
		<tr>
			<th>Nome Completo</th>
			<td><input name="name" type="text" class="textfield" id="name" /></td>
		</tr>
		<tr>
			<th>Email</th>
			<td width="168"><input name="email" type="text" class="textfield" id="email" /></td>
		</tr>
		<tr>
			<th>Confirmar Email</th>
			<td><input name="cemail" type="text" class="textfield" id="cemail" /></td>
		</tr>
		<tr>
			<td> </td>
			<td><input type="submit" name="Submit" value="Registrar" /></td>
		</tr>
	</table>
</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/245989-smart-drop-down-menu/
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.