I need help with PHP or jQuery.
What I need is when user type something in input, if that is valid comes another text. Specifically I need this:
- if age is less then 18 comes text "You are too young"
- if age is equal or more then 18 comes text "You are old enough"
This is my PHP code:
$ime = $_POST['ime'];
$godine = $_POST['godine'];
$poruka = $_POST['poruka'];
$nameErr = $old = $young = "";
if (isset($_POST['submit'])) {
if(empty($_POST['ime'])) {
$nameErr = "Upisite ime";
}
if ($godine < 18) {
$young = "<span class=\"green\">Premladi ste za nastavak</span>";
} elseif ($godine >= 18) {
$old = "<span class=\"blue\">Čestitamo punoljetni ste<span>";
}
}
I don't know if that can be done with PHP but i am sure that jQuery did that.
$godineor$porukashould hold, without using google translate. Furthermore, try to explain what you have tried to achieve the result you want, and on what specific point you got stuck (is there something you don't understand? are the results different then expected? etc. etc.).