Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/03/2011, 12:41
edugilc
 
Fecha de Ingreso: octubre-2009
Mensajes: 154
Antigüedad: 14 años, 6 meses
Puntos: 0
Warning_hidden_field

Pues eso, estoy utilizando un warning_hidden field pero no consigo hacer para que no me aparezca en la pagína web, me aparece tal cual estoa al lado de los botones:

{WARNING_HIDDEN_FIELD}

Y es un pco feo no? :)

La idea es que tengo una función que hace que si metes un nombe y un apellido dando al boton "insert" que ya están en la BD avisa con un mensaje pero si tu kieres meterlo en la BD de todas maneras le das otra vez al "insert " y lo mete:
__________________________________________________ ________
function checkForExistingFirstnameAndLastname (&$tpl,$firstname,$lastname)
{

if (isset($_POST['warning'])==true)
{
return(0);
}
//if warning exists ignore the following lines

global $MySQL;

$sql = "select firstname from customers where firstname = '$firstname' AND surname = '$lastname'";

$result = send_sql($MySQL->db1, $sql);


if (!$result)
{
die ("Database Error");
}

if ((mysql_num_rows($result) != 0))

{
$tpl->assign(FIRST, '<FONT SIZE="2" COLOR="red">** FIRSTNAME AND LAST NAME ALREADY EXITS,DO YOU WANT TO CONTINUE?**</FONT>');


$tpl->assign(WARNING_HIDDEN_FIELD, '<INPUT TYPE="HIDDEN" name="warning" value="1">');
return (1);
}
else
{
$tpl->assign(WARNING_HIDDEN_FIELD,"");
}

return(0);
}

__________________________________________________ _________

Trababjo con plantillas y esto es lo que tengo en ella:

__________________________________________________ _______
.
...
........
.............
<tr>
<td><B>Date (YYYY-MM-DD)</B>
</td>
<td><input type=text name=date_html size=12 maxlength=10 value={DATE} style="width:165px">
</td>
</tr>
<tr>
<td width="30%"><B>Comment</B>
</td>
<td width="70%"><font color=white color=white face="Times New Roman, Times, serif">
<textarea name = "comment_html" rows = "5" cols = "40" style="width:250px"></textarea>
</font>
</td>
</tr>
</table>
<br>
{BUTTONS}

{WARNING_HIDDEN_FIELD}

</form>
</body>
</html>

__________________________________________________ ________


Y lo tengo asi en el archivo *.php y no sé como ponerlo:

__________________________________________________ ________



{
$tpl->assign(NAME, "<FONT COLOR=\"red\"> Error </FONT>");
}


$tpl->assign(BUTTONS, '<input class="buttons" type = "submit" value="Insert" color=blue name="Insert"> <input class="buttons" type="reset" value="Reset" name="reset">');
$tpl->assign(WARNING_HIDDEN_FIELD, '<input class="buttons" type = "hidden">');
//display the template
$tpl->parse(result, "main");
$tpl->FastPrint(result);




Así como lo tengo $tpl->assign(WARNING_HIDDEN_FIELD, '<input class="buttons" type = "hidden">'); no me aparece pero no me funciona.
Si lo comento //$tpl->assign(WARNING_HIDDEN_FIELD, '<input class="buttons" type = "hidden">'); me aparece en la página pero si que me funciona.
No se que hacer..