I need to know how to get to the value selected in the combobox when pressing the submit button and how to call this value in the new file .php
:
I know that there are similar examples here, but be aware that my combobox is not fixed dynamically, and also attention that I have .html
, then .php
and again .html
, this is causing me confusion.
I have the following code:
<?php
require_once('auth.php');
require_once('config.php');
require_once('no-cache-headers.php');
require_once('functions.php');
?>
<title>Nova Mensagem</title>
<link href="Formatacao.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Bem-vindo <?php echo $_SESSION['USERNAME'];?></h1>
<form id="regForm" name="regForm" method="post" action="verificarMensagem.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<?php
mysql_connect('localhost','comunicat','comunicat');
mysql_select_db('Comunicat');
$iduser =$_SESSION['SESS_MEMBER_ID'];
$query="Select * from Usuarios where id <> '$iduser'";
$_SESSION['IdUser'] = $iduser;
$resultado=mysql_query($query);
echo '<select name=”Nome”>';
while($linha=mysql_fetch_array($resultado))
{
echo '<option value="' . $linha['ID'] . '">' . $linha['Nome'] . '</option>';
}
echo '</select>';
?>
<textarea rows="4" cols="50" name="mensagem" id="mensagem">
</textarea>
<td><input type="submit" name="Submit" value="Enviar" /></td>
</tr>
</table>
</form>
</body>
</html>
------------ CheckMessage.php -----------------
$link = new mysqli("localhost", "comunicat", "comunicat", "Comunicat");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$Id_User = $_SESSION['IdUser'];
$nome = $_POST['Nome'];
if ($_SERVER['REQUEST_METHOD'] == 'POST')
....