The technology validation of the forms
First part :
<script type=“text/javascript”>
//<![CDATA[
function checkform()
{
document.getElementById('urltosend').action="addmess2.php";
document.forms['addform'].target=”process”;
top.document.forms['addform'].submit();
}
//]]>
</script>
…
<form id=“urltosend” name=“addform” method=“post” action=“addmess.php”>
…
<input type=“button” onclick=“checkform()” value=“Отправить данные”>
…
<iframe name=“process” id=“process” width=“0″ height=“0″ style=“visibility: hidden”></iframe>
…
<div id=“alerts”></div>
Second part:
<?php
/*
$alerts.=”Error1<br />”;
$alerts.=”Error2<br />”;
и так далее.
*/
print ‘<script type=”text/javascript”>’.“n”;
print ‘//<![CDATA['."n";
if ($alerts)
{
print "top.document.getElementById('alerts').innerHTML='".$alerts."<br />';"."n";
}
else
{
print "top.document.getElementById('alerts').innerHTML='all is great !<br /><br />';"."n";
print "top.document.getElementById('urltosend').action='addmess.php';"."n";
print "top.document.forms['addform'].target=’_top’;”.“n”;
print “top.document.forms['addform'].submit();”.“n”;
}
print ‘//]]>’.“n”;
print ‘</script>’.“n”;
Just simple example javascript and php



December 25th, 2008 at 4:10 pm
[...] DIRECT LINK » Go to Source Share and Enjoy: [...]