Wednesday, April 27, 2011

Wednesday April 27 2011

Finished with the PHP class, have one more week of classes/finals to go. When I am done with that I can start work on the PHP dataminer, see how that goes. Need to start looking at vb.net again as well.


<html>
<head>
<title>Search example</title>
<script type="text/javascript">
function checkSearch()
{
if(!document.getElementById || !document.createTextNode) {return;}
if(!document.getElementById('search')){return;}
var searchValue = document.getElementById('search').value;
if(searchValue=='')
{
alert("Please enter a search term");
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<form action='sitesearch.php' method='post' onsubmit='return checkSearch();'>
<p>
<label for="search">Search this site:
<input type="text" id="search" name="search" />
<input type="submit" value="Search" />
</p>
</form>
</body>
</html>




<head>
<title>Data Example</title>
<script type="text/javascript">
function checkDate()
{
if(!document.getElementById || !document.createTextNode) {return;}
if(!document.getElementById('date')){return;}
// define a regular expression to check the date format
var checkPattern = new RegExp("\\d{2}/\\d{2}/\\d{4}");
//get the value of the current date entry field
var dateValue=document.getElementById('date').value;
//if there is no date entered, don't send the format
if(dateValue='')
{
alert('Please enter a date');
return false;
}
else
{
//tell the user to change the date syntax either until
//she presses cancel or entered the right syntax
while(!checkPattern.test(dateValue) && dateValue!=null)
{
dateValue = prompt("Your date was not in the right format. " + "Please enter it as DD/MM/YYYY.", dateValue);
}
return dateValue != null;
}
}
</script>
</head>
<body>
<h1>Events search</h1>
<form action="eventssearch.php" method="post" onsubmit="return checkDate();">
<p>
<label for="date">Date in the format DD/MM/YYYY:</label><br/>
<input type="text" id="date" name="date" />
<input type="submit" value="check" />
<br />(example 26/04/1975)
</p>
</form>
</body>

No comments: