Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

filter_var php question

Tags:

php

I am making a quick little email script for a contact form and these variable aren't being set($firstName and $lastName).

$firstName = filter_var($_POST['firstName'], FILTER_SANITIZE_STRING);
$lastName = filter_var($_POST['lastName'], FILTER_SANITIZE_STRING);

Note I am a beginner at php

like image 309
Dillon Avatar asked Jun 23 '11 20:06

Dillon


People also ask

What is the use of Filter_var () in PHP?

The filter_var() function filters a variable with the specified filter.

Which is correct syntax of Filter_var ()?

$newstr = filter_var( $str , FILTER_SANITIZE_STRING);

How sanitize URL in PHP?

We can sanitize a URL by using FILTER_SANITIZE_URL. This function removes all chars except letters, digits and $-_. +! *'(),{}|\\^~[]`<>#%";/?:@&=.

What is Filter_validate_email?

The FILTER_VALIDATE_EMAIL filter validates an e-mail address.


1 Answers

You're a beginner? Well, hats off to you for using data validation from the get-go!

can you put this below those two lines and give us the output?

var_dump($firstName, $lastName, $_POST);
like image 57
Dereleased Avatar answered Sep 27 '22 18:09

Dereleased