- 1
How to use the if else statement
I made a contact form and am wondering how i can make a mesage to say that youve not entered your first name please do so
2 Antworten
0
You can use attribute required in input tag:
<input name="user" required>
or use php:
if(empty($_POST['user']) {
echo 'user field is required!';
}
0
you can solve this problem with this code :
HTML :
<Input type="text" name="txt1"/>
<input type="submit" value="get"/>
And you must save that code in a .php file in body tag and you must type under code outside of HTML tag :
<?php
if(isset($_POST(['txt1'])){
echo 'Ok you typed your name';
}else{
echo 'Ohh , you must type your name';
}