Page 1 of 1

I don't get the complete variables

Posted: Sat Sep 05, 2009 2:42 pm
by reddurango
Hi good day i'm having a problem with the post and get methods 'cause i'm sending information trough this mehtods but it arrived incomplete, for example i send "Las Flores" and only arrives "Las" is like if the space did a break, help please

Re: I don't get the complete variables

Posted: Sat Sep 05, 2009 2:46 pm
by Darhazer
Post some code? How you are sending (via a HTML form -then post the HTML, or via a script - then post a script), how you are using the variable (post the script)

Re: I don't get the complete variables

Posted: Sat Sep 05, 2009 2:54 pm
by reddurango
well this is the thing i'm using forms, and i use a hidden line for send the information like this:

Code: Select all

<td>Hotel: </td><td><?php echo $hotel ?><input type="hidden" name="hotel" value=<?php echo $hotel ?>></td>
This code prints: Hotel: Las Flores (and hidden is the input)

as you can see i print the text and is complete but when i send the form trough POST and i get it in this code:

Code: Select all

$message.=" Hotel:  " . $_POST['hotel'] . "\n";
This prints: Hotel: Las

Here only shows 'til the first space

Re: I don't get the complete variables

Posted: Sat Sep 05, 2009 3:22 pm
by Darhazer
You are missing the quotes in the value attribute of the input, this is why you are losing everything after the first space. It should be:

Code: Select all

<td>Hotel: </td><td><?php echo $hotel ?><input type="hidden" name="hotel" value="<?php echo $hotel ?>"></td>
Or even better:

Code: Select all

<td>Hotel: </td><td><?php echo htmlspecialchars($hotel) ?><input type="hidden" name="hotel" value="<?php echo htmlspecialchars($hotel) ?>"></td>