Consider the following form containing textfield and submit button:
<form method="POST" action="<?php isValid();?>" class="urln">
<input name="url" type="text" autocomplete="off" class="urlField"/>
<input name="ybutton" type="submit" value="Add!" class="logButon" action="<?php isValid();?>"/>
</form>
The definition of isValid() is as follows:
function isValid()
{
$string = $_POST['url'];
$youtubeURL = parse_url($string);
if($youtubeURL["host"]=="www.youtube.com")
echo 'videoAdmin.php';
else
echo '';
}
The problem is that sucessful submit of youtube urls happens on the second form submission and not after the first. The idea is to submit correct url’s right after filling the form(maybe some AJAX?). Any help is greatly appreciated.
You can just easily save the POST data in the
$_SESSIONsuperglobal.