Jump to content

Can't insert values into the table (no error message)


TottoBennington
 Share

Recommended Posts

When i touch the button that i've called "submit", the form dissapear and nothing happens.

 

Later i saw the localhost, but VALUES , are not in the table .

 

$submit = @ $_POST['submit'];



if ($submit) 
{   $nombre = strtolower( strip_tags(@ $_POST['nombre']));
     $apellido = strtolower( strip_tags( @ $_POST['apellido']));
     $tel = strip_tags(@ $_POST['telefono']);
     $email = strip_tags(@ $_POST['email']);
     $ubicacion = strtolower( strip_tags( @ $_POST['ubicacion']));
     $opcion = @ $_POST['opcion'];
     $especificacion = strtolower( strip_tags( @ $_POST['especificacion']));
     $explicación = strtolower( strip_tags( @ $_POST['explicacion']));
      

 if (!empty($nombre) && !empty($apellido) && !empty($email) && !empty($tel) && !empty($ubicacion) && !empty($opcion) && !empty($especificacion) &&  !empty($explicacion))
 {
 mysql_connect ("localhost","root","") or die (mysql_error());
     mysql_select_db("pedidos") or die (mysql_error());

 $date = date ("Y-m-d");
 $insert = mysql_query ("INSERT INTO pedidos_recibidos VALUES ('','$nombre','$apellido','$tel','$email','$ubicacion','$opcion','$especificacion','$explicacion','$date')") or die (mysql_error());

 echo 'works!';
 }

 else 
 {
     echo "please fill otu all the fields";
 }
}
?>
<html>
<table id='encargo2' >
     <form action='index.php' method='POST'>
	     <tr>
		     <td>
			    Nombre:
			 </td>
			 <td>
			    <input type='text' name='nombre' value=''>
			 </td>
		 </tr>
		 <tr>
		     <td>
			    Apellido:
			 </td>
			 <td>
			    <input type='text' name='apellido' value=''>
			 </td>
		 </tr>
		 <tr>
		     <td>
			    Telefono:
			 </td>
			 <td>
			    <input type='text' name='apellido' value=''>
			 </td>
		 </tr>
		 <tr>
		     <td>
			    email:
			 </td>
			 <td>
			    <input type='text' name='email' value=''>
			 </td>
		 </tr>
		 <tr>
		     <td>
			    Localidad o ubicación:
			 </td>
			 <td>
			    <input type='text' name='ubicacion'>
			 </td>
		 </tr>
		 <tr>
		     <td>
			    Deseo una web para:
			 </td>
			 <td>
			    <select name='opcion'>
				     <option></option>
				     <option value='almacen'>Almacen o negocio</option>
					 <option value='empresa'>Empresa</option>
					 <option value='club'>Club de barrio</option>
					 <option value='emprendimiento'>Emprendimiento personal</option>
					 <option value='otro'>Otro</option>
				</select>
			 </td>
		 </tr>
			 <tr>
			     <td>
				     Si eligio opción "Otro",<br />
					 especifique con detalles para que:

			     </td>
			     <td>
			         <textarea cols='20' rows='5' name='especificacion'></textarea>
			     </td>
                 </tr>
		 <tr>
		     <td>
			     Explique con sus palabras<br />
				 como quiere que sea la página:
			 </td>
			 <td>
			     <textarea cols='20' rows='5'name='explicacion'></textarea>
			 </td>
		 </tr>
		</table>
	 <p>
	 <input type='submit' name='submit' value='Enviar Pedido'>
 </form>
</html>

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.