Hello,
I'm trying to show a status message created in CSS in a PHP code using Javascript. I can't seem to get the javascript to show the msg. Actually I'm not sure how. Could someone have a look and let me know how i can accomplish this.
Thank you.
<?PHP
// include("/include/connection.php");
[B]if (isset($_POST["submit"]))
{ echo "Testing button press";
echo "javascript:showOrHide();";
}[/B]
else
{ echo 'Button not pressed'; }
?>
<html>
<head>
<title> Add records to table </title>
<link rel="stylesheet" type="text/css" href="css/statusdisplay.css" />
[B]<script language="javascript">
function showOrHide()
{ var div = document.getElementById("showOrHideDiv");
if (div.style.display == "block")
{ div.style.display = "none"; }
else
{ div.style.display = "block"; }
}
</script>[/B]
</head>
<body>
<h1> Add record </h1>
<!-- <div class="info">Info message</div> -->
<!-- <div class="warning">Warning message</div> -->
<div class="success" id="showOrHideDiv" style="display: none" >Record saved... clicked</div>
<!-- <div class="error">Record not found</div> -->
<form action="<?PHP echo $_SERVER['PHP_SELF']; ?>" method="post">
Firstname: <input type="text" name="firstname" />
Lastname: <input type="text" name="lastname" />
Password: <input type="text" name="password" />
Phone: <input type="text" name="phone" />
<input type="submit" value="Submit button!" name="submit" />
</form>
</body>
</html>