html - How do I multiply values in PHP? -
i trying find basic input user enters 1 number , second number , multiplies it.
i got work without isset function, trying echo out error line when page first starts up. if see input named, name , name2 call them in php. original code did not use isset , worked got error before input. php code:
<html> <style> <?php include 'style.css';?> </style> <body> <form method="post"> <p> enter value 1:<input type="text" name="name"> <br> <p> enter value 2:<input type="text" name="name2"><br> <input type="submit" value="send"> </form> <br> <h3>your input:</h3><br> <?php if (isset($_post['name'])) && (isset($_post['name2'])){ $num=$_post['name']; $num2=$_post['name2']; echo $num*$num2; } else{ echo ''; } ?> </body> </html>
you have closed if parentheses soon. line should this:
if (isset($_post['name']) && isset($_post['name2'])) {
Comments
Post a Comment