1

I have an HTML form for a limo company's info, kind of like this:

<td>
     <input type="text" name="sedan-number-fleet" />
</td>
<td>
     <input type="text" name="sedan-year-range" />
</td>

and so on. When I put them into PHP, like so:

$input_sedan_number_fleet = strip_tags($POST['sedan-number-fleet']);
$input_sedan_year_range = strip_tags($POST['sedan-year-range']);

it comes out with no result when I try to echo it. Does it have to do with the strip_tags function? If you know, let me know. That would be great! Thanks!

3 Answers 3

4

You don't access form-submitted data through $POST, but $_POST. Change your code to

$input_sedan_number_fleet = strip_tags($_POST['sedan-number-fleet']);
$input_sedan_year_range = strip_tags($_POST['sedan-year-range']);

And also, I hope you do more input validation than just strip_tags.

Sign up to request clarification or add additional context in comments.

1 Comment

When you run into issues like these, start out by limiting the problems scope and locating the cause. First, I'd do a print_r($POST) then realize that $POST doesn't exist at which point you should confront the documentation. :)
1

replace $POST with $_POST. This should do the job. Additionally, use $_GET instead of $GET and so on (read more here)

Comments

0

I was having trouble with this too. Try using " instead of '.

For example:

$input_sedan_number_fleet = strip_tags($_POST["sedan-number-fleet"]);
$input_sedan_year_range = strip_tags($_POST["sedan-year-range"]);

For some reason that worked for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.