Hi
I have this login page where user enters in and goes to main page, it has a button called enter form >> which on clicks go to a form submission page .
The user enters the form and click submit, once he click submit the form is submitted and in the previous page(which is the main page) the enter form >> button is disabled.
What i have done is i took the value of the submit button from the form page and store in the database.
Then in the previous page(which is the main page), i did a if condition that if the value is submit, disable the enter form >> button...But i think i have some errors in it... it doesnt show any error, but the enter form >> button is not disabled...
Login page >> Main Page(which has the enter form > button) >> Form Page >>
I tried using some javascript also but no idea.....hmm...
My code is as
<script language="javascript">
function disable()
{
document.form1.button.disabled = true;
}
</script>
</head>
<body>
<?php
$db = "db";
$link = mysql_connect("localhost","root","");
if (!$link)
{
die("Couldn't connect to MySQL");
}
mysql_select_db("db",$link)
or die("Couldn't open $db: ".mysql_error($link));
$query = "SELECT sbutton FROM user_report";
//$result = mysql_query($query) or die(mysql_error());
$result = mysql_query($query);
$row = mysql_fetch_array($result);
//$ic=$row->sbutton;
//$ic=$row["sbutton"];
if ($row == 'Submit')
{
echo "<SCRIPT LANGUAGE='javascript'>disable();</SCRIPT>";
//$disabled = 'disabled = "disabled"';
}
?>
<form id="form1" name="form1" method="post" action="report1.php">
<label>
<input type="submit" name="button" id="button" value="Create Form"/>
</label>
</form>
</body>
</html>
Where have i gone wrong...