Foros del Web » Programando para Internet » PHP »

Ayuda con formulario

Estas en el tema de Ayuda con formulario en el foro de PHP en Foros del Web. Código PHP: <? ?> <div id="contenido"> <div id="contenido_pg"> <? $page_title  =  " &raquo; Agregar Comentario" ; if( $Submit ){ if( $name  ==  "" ) { $error_message  =  "Porfavor, ingresa tu nombre" ; }else ...
  #1 (permalink)  
Antiguo 12/11/2009, 18:05
Avatar de ColdFusion  
Fecha de Ingreso: octubre-2008
Ubicación: Tocoa, Colon Honduras C.A.
Mensajes: 419
Antigüedad: 15 años, 6 meses
Puntos: 9
Ayuda con formulario

Código PHP:
<?

?>
<div id="contenido">
<div id="contenido_pg">
<?
$page_title 
" &raquo; Agregar Comentario";

if(
$Submit){
if(
$name == "")
{
$error_message "Porfavor, ingresa tu nombre";
}else
if(
$email == "")
{
$error_message "Porfavor, ingresa tu email";
}else

if(
$message == "")
{
$error_message "Porfavor, ingresa tu message";
}else
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['savasguestbook']){
$message str_replace("<""&lt;"$message);
$message str_replace(">""&gt;"$message);
mysql_query ("INSERT INTO entries (name, email, website, gender, message , date, approved) VALUES ('$name', '$email', '$website', '$gender', '$message', '$date', 'Yes')");
$error_message "$name your entry was submitted succesfully but it will appear on the website after admin moderation.";
if(
$notify == "yes"){
    
mail("$admin_email","New GuestBook Entry""Hello GuestBook Admin,\n$name has just posted a message on your guestbook. He said:\n$message\n\nVisit your admin panel to approve, edit or delete his entry.\n\n-----------------------\nSava's GuestBook""From: Sava's GuestBook <guestbook@myguestbook>");
    }
$name "";
$email "";
$message "";
}
else
{
$error_message "Please Enter the Correct Verification Text From the Image";
}
}
?>
<table width="540" class="entry">
  <tr><td width="621" class="info"><h2>Agregar Comentario</h2></td></tr><tr><td><? echo $error_message?>
<form action=""  method="post" />
<table>
<tr>
  <td>Nombre:</td>
  <td><input type="text" name="name" value="<? echo $name?>" /></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" value="<? echo $email?>" /></td></tr>
<tr><td>Website:</td><td><input type="text" name="website" value="<? echo $website?>" /> 
Debe iniciar con http://</td>
</tr>
<tr>
  <td>Genero:</td>
  <td><select name="gender"><option value="Male">Hombre</option><option value="Female">Mujer</option></select></td></tr>
<tr>
  <td>Mensaje:</td>
  <td><textarea name="message" rows="5" cols="55"><? echo $message?></textarea></td></tr>
<tr>
<td>Verificacion:</td>
<td><input type="hidden" name="verificationnr" value="<? echo '' $verificationnr '';?>" /><img src="verificationimage.php?<?php echo rand(10000,99999);?>" alt="verification image, type it in the box" width="60" height="24" align="left" />  <input type="text" id="verif_box" name="verifbox" maxlength="5" size="5" /></td></tr>
<tr><td style="border: none;"></td><td style="border: none;"><input type="submit" name="Submit" /></td></tr></table>
</td></tr></table>
</div>
<div id="sidebar">
<h2>Navegacion</h2>
<ul>
<li><a href="index.php" title="Home">Inicio</a></li>
<li><a href="agregar.php">Agregar Mensaje</a></li>
</ul>
</div>
</div>
<? include('../inc/pie.php'); ?>
Nesecito que al enviarse, se borren los datos de los input y redireccione al index
"Codigo Savas Guestbook v2"
  #2 (permalink)  
Antiguo 12/11/2009, 21:49
 
Fecha de Ingreso: agosto-2009
Mensajes: 247
Antigüedad: 14 años, 8 meses
Puntos: 10
Respuesta: Ayuda con formulario

Cita:
<form action="tu_index.php"
lo de borrar los datos.......deberias preguntarlo en el foro de JS

Salu2!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:04.