Jump to content

undefined index index Notice persistent error


angello

Recommended Posts

Hi, im trying to make a very simple script, but i just can?t make it work, i want something like this, this is the HTML code:

 

<form action="procesar.php" method="post" name="frm">
  <input type="text" name="nombre" />
  <input type="text" name="apellido" />
  <input type="password" name="pw" />
  <input type="submit" value="Enviar" />
</form>

 

and this woul?d be the PHP code in the respective file "procesar.php"

$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$pw = $_POST['pw'];

echo $nombre. "<br>";
echo $apellido. "<br>";
echo $pw;  

 

as you can see, it just works great, you don?t even have to run it to see what it does, now my question is WHY my code does NOT work, this is the HTML code:

 

<form action="destiniaXMLrequest.php" method="post" name="getxmlrequest">

<label>Ciudad</label><input class"inputbox" name="location_name" type="text"/><br/>
<label>Idioma</label><input class"inputbox" name="idioma" type="text" /><br/>
<label>Cantidad de habitaciones</label> <select name="cantidad_habitaciones"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select><br/>
<label>Adultos</label> <select name="adultos"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select><br/>
<label>Ni?os</label> <select name="ninos"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select><br/>


<label>Dia de entrada</label> <input class="inputbox" type="text" name"chkinday"  id="chkinday" alt="mm/dd/yy" /><br/>
<label>Mes de entrada</label><input class="inputbox" type="text"  name"chkinmnt"  id="chkinmnt" alt="mm/dd/yy" /><br/>
<label>A?o de entrada</label><input class="inputbox" type="text"  name"chkinyr"   id="chkinyr" alt="mm/dd/yy" /><br/>

<label>Dia de salida</label><input class="inputbox" type="text"   name"chkoutday"  id="chkoutday" alt="mm/dd/yy" /><br/>
<label>Mes de salida</label><input class="inputbox" type="text"   name"chkoutmnt"  id="chkoutmnt" alt="mm/dd/yy" /><br/>
<label>A?o de salida</label><input class="inputbox" type="text"   name"chkoutyr"   id="chkoutyr" alt="mm/dd/yy" /><br/>

<label>Codigo Afiliado Destinia</label>			<input type="text" name="codigo_afiliado" /><br/>
<label>Identificador Afiliado destinia</label>  <input type="text" name="identificador_afiliado" /><br/>
<input type="submit" value="Enviar" />
</form>

 

and this is the PHP code of the respective file "destiniaXMLrequest.php":

 

$location_name = $_POST['location_name'];
$language_code = $_POST['idioma'];
$num_rooms = $_POST['cantidad_habitaciones'];
$num_adults = $_POST['adultos'];
$num_children = $_POST['ninos']; 
$checkin_day = $_POST['chkinday'];
$checkin_month = $_POST['chkinmnt'];
$checkin_year = $_POST['chkinyr'];
$checkout_day = $_POST['chkoutday'];
$checkout_month = $_POST['chkoutmnt'];
$checkout_year = $_POST['chkoutyr'];
$codigo_afiliado = $_POST[''];
$identificador_afiliado = $_POST['destinia'];

echo $location_name."<br>" ;
echo $language_code."<br>";
echo $num_rooms."<br>";
echo $num_adults."<br>";
echo $num_children."<br>";
echo $checkin_day."<br>";
echo $checkin_month."<br>";
echo $checkin_month."<br>";      
echo $checkin_year."<br>";
echo $codigo_afiliado ."<br>";
echo $identificador_afiliado."<br>"; 

 

I have a "Notice: Undefined index error", from line 7 to line 14, WHY god, somebody please help me, is a long long road to me, im trying to make work a hotel reservations page, and im trying to make work the searchbox, i have to send this data to the reservacions server as a request, and then get an XML response, but first im trying to see if i can make work this script.

THANKS in advance for any help.

Link to comment
Share on other sites

Thank you very much, i solve it my self, and i really still don?t know what was, but the new code in html is this:

<form action="destiniaXMLrequest.php" method="post" name="getxmlrequest">

<label>Ciudad</label><input name="location_name" type="text"/><br/>
<label>Idioma</label><input name="idioma" type="text" /><br/>
<label>Cantidad de habitaciones</label> <select name="cantidad_habitaciones"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select><br/>
<label>Adultos</label> <select name="adultos"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select><br/>
<label>Ni?os</label> <select name="ninos"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select><br/>


<label>Dia de entrada</label> <input type="text"  name="dia_de_entrada" id="chkinday"/><br/>
<label>Mes de entrada</label><input  type="text"  name="mes_de_entrada" id="chkinmnt"/><br/>
<label>A?o de entrada</label><input  type="text"  name="ano_de_entrada" id="chkinyr"/><br/>

<label>Dia de salida</label><input  type="text"   name="dia_de_salida"  id="chkoutday"/><br/>
<label>Mes de salida</label><input  type="text"   name="mes_de_salida"  id="chkoutmnt"/><br/>
<label>A?o de salida</label><input  type="text"   name="ano_de_salida"  id="chkoutyr"/><br/>

<label>Codigo Afiliado Destinia		  </label>	<input type="text" name="codigo_afiliado"/><br/>
<label>Identificador Afiliado destinia</label>  <input type="text" name="identificador_afiliado"/><br/>

<input type="submit" value="Enviar" /><br/>
<input type="reset" value="Borrar Todo" />

</form>

if you check , i was missing a lot of "=" equals,  in the "name" attribute

and i don?t know what else, but this is the new php code:

$location_name 	= $_POST['location_name'];
$language_code 	= $_POST['idioma'];
$num_rooms 		= $_POST['cantidad_habitaciones'];
$num_adults	 	= $_POST['adultos'];
$num_children		= $_POST['ninos']; 
$checkin_day 		= $_POST['dia_de_entrada'];
$checkin_month 	= $_POST['mes_de_entrada'];
$checkin_year 		= $_POST['ano_de_entrada'];
$checkout_day 		= $_POST['dia_de_salida'];
$checkout_month	= $_POST['mes_de_salida'];
$checkout_year		= $_POST['ano_de_salida'];
$codigo_afiliado	= $_POST['codigo_afiliado'];
$identificador_afiliado = $_POST['identificador_afiliado'];

echo $location_name."<br>" ;
echo $language_code."<br>";

echo $num_rooms."<br>";
echo $num_adults."<br>";
echo $num_children."<br>";

echo $checkin_day."<br>";
echo $checkin_month."<br>"; 
echo $checkin_year."<br>";	
   
echo $checkout_day."<br>";
echo $checkout_month."<br>";
echo $checkout_year."<br>";


echo $codigo_afiliado ."<br>";
echo $identificador_afiliado."<br>";

Now it work great, now i have to send the request to the server, i still don?t have an idea of how but i will find out, thanks guys

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.