RE: [PHP-ES] Duda con SELECT
| From: | Gabriel Carbone | Date: | Thu, 29 Aug 2002 14:14:36 +0000 |
| Subject: | RE: [PHP-ES] Duda con SELECT | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-26311@lists.php.net to get a copy of this message | ||
Primero probaria asi, si llega una variable,
si llega continuo con las demas
<form action="results.php" method="post">
<select name="searchtype">
<option value="">Seleccionar</option>
<option value="author">Author</option>
<option value="title">Title</option>
<option value="isbn">ISBN</option>
</select>
<input type="submit" name="algo" value="Search">
</form>
Y en el php:
print $searchtype;
Y para verificar que se seleccione algo:
if($searchtype == ""){
print "Debe seleccionar algo<br>";
}
> Angel y Manuel:
> creo que el formulario esta todo bien:
> <form action="results.php" method="post">
> Choose Search Type:<br>
> <select name="searchtype">
> <option value="author">Author
> <option value="title">Title
> <option value="isbn">ISBN
> </select>
> <br>
> Enter Search Term:<br>
> <input name="searchterm" type=text></input>
> <br>
> <input type=submit value="Search"></input>
> </form>
>
> sin embargo en results.php he probado todo esto y continuo obteninedo
> errores.
>
> 8 echo $searchterm;
> 9 echo $HTTP_POST_VARS("searchterm");
> 11 trim($searchterm);
>
> 13 if (!$searchtype||!$searchterm)
> 14 {
> 15 echo "You have not entered search details.Please go back and try
> 16 again.";
> 17 exit;
> 18 }
>
> Notice: Undefined variable: searchterm in
> C:\Inetpub\wwwroot\MySQL\results.php on line 8
>
> Notice: Array to string conversion in
> C:\Inetpub\wwwroot\MySQL\results.php
> on line 9
>
> Fatal error: Call to undefined function: array() in
> C:\Inetpub\wwwroot\MySQL\results.php on line 9
>
> Que opinan?.
> Gracias