[SOLUCIONADO] [Taller PHP] Duda taller php 1 ejercicio 2

Iniciado por arthusu, Julio 18, 2011, 01:39:14 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Julio 18, 2011, 01:39:14 AM Ultima modificación: Marzo 22, 2014, 02:13:34 PM por Expermicid
Bueno me estoy inciando en php aca con los geniales manuale de xt3mp pero lo que pasa es que me sale un error Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\AppServ\www\taller\prueba2.php on line 7
y no se cual es el error aca va el code:

HTML:
Código: html5
<html>
<head><title></title></head>
<body>
<form action="prueba2.php" method="POST">
Nombre: <input type="text" name="nombre"><br />
Edad:
<select name="edad" >
<option value="20a40">20 a 40</option>
<option value="19">19</option>
<option value="18" selected="selected">18</option>
<option value="17">17</option>
</select><br />
Correo: <input type="text" value="@hotmail.com" name="correo"> <br />
Pais:
<select name="pais">
<option value="1">Argentina</option>
<option value="2">España</option>
<option value="3" selected="selected">Mexico</option>
<option value="4">Colombia</option>
</select><br />
Ciudad: <input type="text" name="ciudad"><br />
<input type="submit" name="enviar" value="Enviar!"><br />
</form>
</body>
</html>


y el PHP:
Código: php
<html>
<head><title></title></head>
<body>
<?php
$nombre=$_POST['nombre'];
echo  "Tu nombre es $nombre;"
$edad=$_POST['edad'];
echo "Tu edad es $edad;"
$correo=$_POST['correo'];
if($correo = "@gmail.com" or "@hotmail.com" ){
echo "Tu correo es $correo;"
}else{
echo "El correo tiene que ser hotmail;"}
?>
</body>
</html>


PD: no lo he terminado todo por que me quede en la parte de poder arreglar el error, grcias por su atencion, saludos!
Pentest - Hacking & Security Services

Contact me: You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Pusiste el punto y coma ( ; ) antes de las comillas y no despúes:

Código: php

<?php
$nombre=$_POST['nombre'];
echo "Tu nombre es $nombre";
$edad=$_POST['edad'];
echo "Tu edad es $edad";
$correo=$_POST['correo'];
if($correo = "@gmail.com" or "@hotmail.com" ){
echo "Tu correo es $corre";
}else{
echo "El correo tiene que ser hotmail";
}
?>


Saludos.
Cada vez que me das Karma me motivas

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Pusiste el punto y coma ( ; ) antes de las comillas y no despúes:

Código: php

<?php
$nombre=$_POST['nombre'];
echo "Tu nombre es $nombre";
$edad=$_POST['edad'];
echo "Tu edad es $edad";
$correo=$_POST['correo'];
if($correo = "@gmail.com" or "@hotmail.com" ){
echo "Tu correo es $corre";
}else{
echo "El correo tiene que ser hotmail";
}
?>


Saludos.
Gracias Xt3mP por tu rapida respuesta jahjaha las comillas te cagan el codigo jhajaha ala ora ya me fijo bien uno aprende de sus errores.!
Pentest - Hacking & Security Services

Contact me: You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

jaja termine el codigo gracias a xt3mp aca lo dejo:
prueba2.html
Código: html5
<html>
<head><title></title></head>
<body>
<form action="prueba2.php" method="POST">
Nombre: <input type="text" name="nombre"><br />
Edad:
<select name="edad" >
<option value="20a40">20 a 40</option>
<option value="19">19</option>
<option value="18" selected="selected">18</option>
<option value="17">17</option>
</select><br />
Correo: <input type="text" name="correo">
<select name="correo1">
<option>@hotmail.com</option>
<option>@gmail.com</option>
</select> <br />
Pais:
<select name="pais">
<option value="Argentina">Argentina</option>
<option value="España">España</option>
<option value="Mexico" selected="selected">Mexico</option>
<option value="Colombia">Colombia</option>
</select><br />
Ciudad: <input type="text" name="ciudad"><br />
<input type="submit" name="enviar" value="Enviar!"><br />
</form>
</body>
</html>


prueba2.php
Código: php
<html>
<head><title></title></head>
<body>
<?php
$nombre=$_POST['nombre'];
echo  "Tu nombre es <b> $nombre </b>";
echo "<br />";
$edad=$_POST['edad'];
echo "Tu edad es <b> $edad </b>";
echo "<br />";
$correo=$_POST['correo'];
$correo1=$_POST['correo1'];
echo "Tu correo es: <b> $correo </b> <b> $correo1 </b>";
echo "<br />";
$pais=$_POST['pais'];
echo "Tu pais es <b> $pais </b>";
echo "<br />";
$pais=$_POST['ciudad'];
echo "Tu pais es <b> $ciudad </b>";
echo "<br />";
//Termine el codigo XD porfin jajajaja :P
?>
</body>
</html>
Pentest - Hacking & Security Services

Contact me: You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login