I'm having a problem and I don't know how to solve it.
I have two files one is a form and the other a verification.
My users can select in the list/menu multiple items, and I need to make the query only to this selectiom.
my form code is:
Code: Select all
<?
include("config.php");
viewheader();
echo "<FORM ACTION='conf_sector.php' METHOD='GET' NAME='busca_sector'>";
echo "<TABLE CELLSPACING='0' CELLPADDING='0' BORDER='0' WIDTH='375' BGCOLOR='#99B9D0'>";
echo " <TBODY>";
echo " <TR> ";
echo " <TD><IMG SRC='cp-bcorn.gif' WIDTH='13' HEIGHT='12'></TD>";
echo " <TD WIDTH='100%'></TD>";
echo " <TD ALIGN='right'><IMG SRC='cp-bcorn2.gif' WIDTH='13' HEIGHT='12'></TD>";
echo " </TR>";
echo " <TR> ";
echo " <TD COLSPAN='3' ALIGN='CENTER'><TABLE WIDTH='100%' CELLPADDING='2' CELLSPACING='1'>";
echo " <TR> ";
echo " <TD VALIGN='MIDDLE' ALIGN='RIGHT' WIDTH='75'><P>Sector*:</P></TD>";
echo " <TD VALIGN='MIDDLE' ALIGN='LEFT'>
<SELECT MULTIPLE NAME='busca_sector'>
<option value='ONE'>ONE</option>
<option value='TWO'>TWO</option>
</SELECT></TD>";
echo " </TR>";
echo " </TR>";
echo " </TABLE>";
echo " <INPUT name='SUBMIT' TYPE='SUBMIT' CLASS='button' VALUE='SEND'>";
echo " ";
echo " </TD>";
echo " </TR>";
echo " </TBODY>";
echo "</TABLE>";
echo " </FORM>";
?>Code: Select all
<?php
include 'config.php';
db_connect();
viewheader();
$sql = "SELECT * FROM `$dbtable` WHERE `sector_emp` LIKE '%{$_GET['busca_sector']}%' ";
$res = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
if (mysql_num_rows($res) < 1) {
echo '<p style="margin: 30 0 10 0;">EN ESTE SECTOR NO HAY USUARIOS REGISTRADOS!!!!</p>';
echo '<h4><a href="javascript:history.back()">Regresar</a></h4>';
} else {
?>
<h4>USER DATA</h4>
<table width="80%" border="0" cellpadding="1" cellspacing="0" class="textfield2">
<tr bgcolor="#F6F6F6">
<td valign="top" align="right">
- <a href='menu.php'>REGRESAR</a> - - <a href='logout.php'>SALIR</a> -
</td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center">
<tr bgcolor="#F1F1F1">
<td valign="top" colspan="5"> </td>
</tr>
<tr bgcolor="#F6F6F6">
<th style="text-align: left;">NAME</th>
<th style="text-align: left;">Email</th>
<th style="text-align: left;">CONSULT</th>
<th>Mail</th>
<th>Seguimiento</th>
</tr>
<?php
while ($row = mysql_fetch_assoc($res)) {
?>
<tr bgcolor="<?php echo $bgColor; ?>">
<td valign="top">
<b><?php echo $row['nombre']; ?> <?php echo $row['apellido1']; ?> <?php echo $row['apellido2']; ?></b>
</td>
</tr>
<?php
} // end while
?>
</table>
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td valign="top" align="right">
- <a href='menu.php'>RETURN</a> - - <a href='logout.php'>LOG OUT</a> -
</td>
</tr>
</table>
<?php
} // end if
?>I really apreciate the help, 'cause it's the final step of a project.
Thanks Mario
[mod_edit:
Code: Select all
tags added, rewrote CapsLock-text, if I added new typos: so sorry ][/size]