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
The filter_var() function filters a variable with the specified filter.
$newstr = filter_var( $str , FILTER_SANITIZE_STRING);
We can sanitize a URL by using FILTER_SANITIZE_URL. This function removes all chars except letters, digits and $-_. +! *'(),{}|\\^~[]`<>#%";/?:@&=.
The FILTER_VALIDATE_EMAIL filter validates an e-mail address.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With