I'm calling PHP function from html and I want to make sure that one thing happens when the corresponding input box is empty and other thing when not. for some reason PHP recognises it always as not empty. can't figure out why.
html snippet:
<input type="button"
value="checkout"
onClick="self.location='testphp.php?checkout=true&folderName=\'' + document.folderForm.folderLocation.value + '\''">
</button>
<form enctype="multipart/form-data" method="post" name="folderForm">
<input type=file name="myfile">
<input type=text name="folderLocation" id="folderLocation">
<input type=hidden name="folderName">
<input type=button value="Get Folder" onclick="javascript:GetFolder();">
<input type=hidden name=submitted value=1>
<input type="submit" value="Create Repository" />
</form>
php snippet:
if($_GET['checkout']){
if( isset( $_GET['folderName'] ) && !empty( $_GET['folderName'] ) ) {
echo $_GET["folderName"];
echo exec("/var/www/html/checkout.sh ".$_GET["folderName"]);
} else {
echo "<script type='text/javascript'>alert('Please choose repository from the list first');</script>";
}
}
any ideas?