reactor86
05-10-2009, 08:39 AM
Hi everyone , i have an html with several forms and a php where i compare the the submited for and perform file execution. What i need is that i want my forms work without refreshing the page. I read that there should be used AJAX but i really don't know it and need your help.
this is my test.html
<html>
<body>
<form action="phpform.php" method="post" target="_self">
<input name="submit" type="submit" value="W" />
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit2" value="U" />
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit3" value="Q" onmouseover/>
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit4" value="S" />
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit5" value="B" />
</form>
</body>
</html>
and this is my phpform.php
<?php
if(isset($_POST['submit']))
{
echo exec('test.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit2']))
{
echo exec('test2.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit3']))
{
echo exec('test3.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit4']))
{
echo exec('test4.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit5']))
{
echo exec('test5.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
else{
echo "end";
}
?>
Any help would be appreciated , thanks
this is my test.html
<html>
<body>
<form action="phpform.php" method="post" target="_self">
<input name="submit" type="submit" value="W" />
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit2" value="U" />
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit3" value="Q" onmouseover/>
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit4" value="S" />
</form>
<form action="phpform.php" method="post" target="_self">
<input type="submit" name="submit5" value="B" />
</form>
</body>
</html>
and this is my phpform.php
<?php
if(isset($_POST['submit']))
{
echo exec('test.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit2']))
{
echo exec('test2.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit3']))
{
echo exec('test3.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit4']))
{
echo exec('test4.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
elseif(isset($_POST['submit5']))
{
echo exec('test5.bat');
echo "<meta http-equiv=refresh content=\"0; URL=form.html\">";
}
else{
echo "end";
}
?>
Any help would be appreciated , thanks