Hola amigos, tengo un pequeño problemita, yo se que alomejor es muy bobo pero ya tengo 1 día con el, lo que pasa esque tengo un formulario para dar de alta usuarios
mi problema es que cuando doy de alta me llena de campos vacios la BD.... y si intento imprimir las variables que tienen los campos asi
print " $name, $lastname1, '$lastname2', '$address', '$cp', '$sex',
'$email','$phone','$state','$ocupation','$day', '$month', '$year', '$mun'";
solo me muestra , '', '', '', '', '','','','','', '', '', ''
este es el codigo completo
<form name="form1" method="post" action="formulario.php" >
<table>
<tr>
<td>Nombre y contraseña</td>
</tr>
<tr>
<td>Usuario</td>
<td><input type="text" size="15" maxlength="30" name= "user" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" size="15" name= "password" /></td>
</tr>
<tr>
<td>Datos Generales:</td>
</tr>
<tr>
<td> Nombre:</td> <td><input type="text" size="15" maxlength="30" name= "name" id= "name"/></td> <td></td>
</tr>
<tr>
<td> Apellido Paterno:</td><td><input type="text" size="15" maxlength="30" name= "lastname1" id= "lastname1"/></td><td></td>
</tr>
<tr>
<td> Apellido Materno:</td><td><input type="text" size="15" maxlength="30" id= "lastname2" name= "lastname2" /></td><td
</tr>
<tr><td>Sexo:</td>
<td><select size="1" id= "sex" name= "sex" >
<option value="-----" selected="selected">-----</option>
<option>M</option>
<option>F</option>
</select></td><td></td>
</tr>
<tr>
<td>Fecha de Nacimiento:</td>
</tr>
<tr>
<td>Dia</td><td><select size="1" id= "day" >
<option value="-----" selected="selected">-----</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select> </td><td></td>
<td>Mes</td><td> <select name="month" id="month">
<option value="-----" selected="selected">-----</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select> </td><td></td>
<td>Año</td><td> <select name="year" id="year">
<option>1920</option>
<option>1921</option>
<option>1922</option>
<option>1923</option>
<option>1924</option>
<option>1925</option>
<option>1926</option>
<option>1927</option>
<option>1928</option>
<option>1929</option>
<option>1930</option>
<option>1931</option>
<option>1932</option>
<option>1933</option>
<option>1934</option>
<option>1935</option>
<option>1936</option>
<option>1937</option>
<option>1938</option>
<option>1939</option>
<option>1940</option>
<option>1941</option>
<option>1942</option>
<option>1943</option>
<option>1944</option>
<option>1945</option>
<option>1946</option>
<option>1947</option>
<option>1948</option>
<option>1949</option>
<option>1950</option>
<option>1951</option>
<option>1952</option>
<option>1953</option>
<option>1954</option>
<option>1955</option>
<option>1956</option>
<option>1957</option>
<option>1958</option>
<option>1959</option>
<option>1960</option>
<option>1961</option>
<option>1962</option>
<option>1963</option>
<option>1964</option>
<option>1965</option>
<option>1966</option>
<option>1967</option>
<option>1968</option>
<option>1969</option>
<option>1970</option>
<option>1971</option>
<option>1972</option>
<option>1973</option>
<option>1974</option>
<option>1975</option>
<option>1976</option>
<option>1977</option>
<option>1978</option>
<option>1979</option>
<option>1980</option>
<option>1981</option>
<option>1982</option>
<option>1983</option>
<option>1984</option>
<option>1985</option>
<option>1986</option>
<option>1987</option>
<option>1988</option>
<option>1989</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option value="-----" selected="selected">-----</option>
</select></td><td></td>
</tr>
<tr>
<td>Direccion</td>
</tr>
<tr>
<td>Calle y Número</td>
<td><input type="text" size="15" maxlength="30" id= "address" /></td><td></td>
</tr>
<tr>
<td>Municipio</td>
<td><input type="text" size="15" maxlength="30" id= "mun" /></td><td></td>
</tr>
<tr>
<td>Estado</td>
<td><input type="text" size="15" maxlength="30" id= "state" /></td><td></td>
</tr>
<tr>
<td>CP:</td>
<td><input type="text" size="15" maxlength="30" id= "cp" /></td> <td></td>
</tr>
<tr>
<td>Otros Datos</td>
</tr>
<tr>
<td>Ocupación</td>
<td><select size="1" id= "ocupation" >
<option value="-----" selected="selected">-----</option>
<option>Estudiante</option>
<option>Empleado</option>
<option>Empresario</option>
<option>Ama de Casa</option>
</select></td><td></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" size="15" maxlength="30" id= "email" /></td><td></td>
</tr>
<tr>
<td>Teléfono</td>
<td><input type="text" size="15" maxlength="30" name = "phone" id = "phone" /></td><td></td>
</tr>
<tr><td><p align="right"><input TYPE="image" SRC="boton.gif"></p></td></tr>
</table>
</form>
y este es el codigo php
<?php
$query = "INSERT INTO usuario (nombre, apPaterno, apMaterno, direccion, cp, sexo, email, telefono, estado, ocupacion, dia, mes, ano, municipio)
VALUES('$name', '$lastname1', '$lastname2', '$address', '$cp', '$sex',
'$email','$phone','$state','$ocupation','$day', '$month', '$year', '$mun')";
$query1 = "INSERT INTO login
VALUES('$user', '$password')";
if(mysql_query($query1)){
}else{
echo "El Nombre de Usuario ya existe, por favor seleccione otro";
}
if(mysql_query($query)){
}else{
echo "Error al Darse de Alta, por favor pruebe más tarde";
}
?>