Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 14700

Ajuda com search

$
0
0
Bom dia,

Procuro algum programador que me possa ajudar com uma pesquisa em php, neste momento tenho a pesquisa a funcionar perfeitamente, mas a ideia era fazer uma pequena alteração.

actualmente o que possuo é o seguinte:

<form method="post" id="searchform" action="<?php echo $PHP_SELF;?>">
<div>
<ul style="list-style-type:none;padding:0">
<li>
<h4>______</h4>
<input type="text" <?php if (isset($_POST['s'])) {
echo 'value="'.$_POST['s'].'"';} else { echo 'value=""';}  ?> name="s" id="s" />
</li>
<li>
<h4>Estado:</h4>
<select name="estado">
<option value="0" <?php if (isset($_POST['estado']) &&  $_POST['estado'] == 0) {
echo 'selected="selected"';}  ?>>opção 1</option>
<option value="1" <?php if (isset($_POST['estado']) &&  $_POST['estado'] == 1) {
echo 'selected="selected"';}  ?>>opção 2</option>
<option value="2" <?php if (isset($_POST['estado']) &&  $_POST['estado'] == 2) {
echo 'selected="selected"';}  ?>>opção 3</option>
</select>
</li>
<li>
<input type="submit" id="searchsubmit" value="Pesquisar" class="submit" />
</li>


a pesquisa retorna apenas o estado "1", "2" ou "3" conforme o que eu escolher, a ideia será eliminar esta opção da pesquisa e inclui-la no resultado

ex: em vez de eu procurar playmobil em "estado 1", apenas pesquisar a palavra playmobil e no retorno da pesquisa aparecer "playmobil - estado 1"

o codigo para a construção da resposta à pesquisa é o seguinte:

if($estado==2)
echo '<tr style="color:#000;background-color:#e3e3e3">
<td>
<table cellspacing=5>
<tr>
<td width=300 style="vertical-align:top"><b>_______</b><br/>'
. utf8_encode($row['______'])
. '</td>
<td width=300 style="vertical-align:top"><b>_______</b><br/>'
. utf8_encode($row['________'])
. '</td>
</tr>
<tr>
<td width=300 style="vertical-align:top"><b>________</b><br/>'
. $cert
. '</td>
<td width=300 style="vertical-align:top"><b>________</b><br/>'
. utf8_encode($row['__________'])
. '</td>
</tr>
<tr>
<td width=300 style="vertical-align:top"><b>__________</b><br/>'
. utf8_encode($row['_____'])
. '</td>
<td width=300 style="vertical-align:top"> </td>
</tr>
</table>
</td>
</tr>';
elseif($estado==1)
echo '<tr style="color:#000;background-color:#e3e3e3">
<td>
<table cellspacing=5>
<tr>
<td width=300 style="vertical-align:top"><b>_________</b><br/>'
. utf8_encode($row['__________'])
. '</td>
<td width=300 style="vertical-align:top"><b>__________</b><br/>'
. utf8_encode($row['_____________'])
. '</td>
</tr>
<tr>
<td width=300 style="vertical-align:top"><b>_______</b><br/>'
. $cert
. '</td>
<td width=300 style="vertical-align:top"><b>____________</b><br/>'
. utf8_encode($row['__________'])
. '</td>
</tr>
<tr>
<td width=300 style="vertical-align:top"><b>_____________</b><br/>'
. utf8_encode($row['_____'])
. '</td>
<td width=300 style="vertical-align:top"> </td>
</tr>
</table>
</td>
</tr>';
else
echo '<tr style="color:#000;background-color:#e3e3e3">
<td>
<table cellspacing=5>
<tr>
<td width=300 style="vertical-align:top"><b>___________</b><br/>'
. utf8_encode($row['______________'])
. '</td>
<td width=300 style="vertical-align:top"><b>______________</b><br/>'
. utf8_encode($row['--------------'])
. '</td>
</tr>
<tr>
<td width=300 style="vertical-align:top"><b>_________</b><br/>'
. $cert
. '</td>
<td width=300 style="vertical-align:top">
   </td>
</tr>
<tr>
<td width=300 style="vertical-align:top"><b>_____________</b><br/>'
. utf8_encode($row['__________'])
. '</td>
<td width=300 style="vertical-align:top"> </td>
<p class="aligncenter"> ______________________________</p></td>
</tr>
</table>
</td>
</tr>';



Já tentei fazer diversas alterações ao codigo, mas como o php não é o meu forte consigo que o resultado funcione como eu quero para o valor "2" mas as entradas que estão com os valores "0" e "1" não retornam nada.

Poderiam me ajudar

desde já os meus agradecimentos

JM

Viewing all articles
Browse latest Browse all 14700