note 108837 added to function.strlen
| From: | raisinghkalwa | Date: | Tue, 29 May 2012 04:44:50 +0000 |
| Subject: | note 108837 added to function.strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188276@lists.php.net to get a copy of this message | ||
Sample
<?php
if(isset($_POST['submit']))
{
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$age=$_POST['age'];
$address=$_POST['address'];
$salary=$_POST['salary'];
$borrow=$_POST['borrow'];
echo "form submitted successfully";
}
else
{
echo "form not submitted";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Loan Application Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<b>ICICI Credit Bank Loan Application Form</b>
<br/>
<br/>
<form action="../My%20Documents/loan.php" method="post">
First Name<input name="fname" type="text" size="20"
maxlength="10">
Last Name<input name="lname" type="text" size="20"
maxlength="10">
Age<input name="age" type="text" size="5"
maxlength="5">
<br/>
<br/>
Address<textarea name="address" cols="30"
rows="5"></textarea>
<br/>
<br/>
What is your current salary?
<select name="salary">
<option value="0" selected>Under $10,000</option>
<option value="10000">$10,000-$25,000</option>
<option value="25000">$25,000-$50,000</option>
<option value="50000">Over $50,000</option>
</select>
<br/>
<br/>
How much you want to borrow?
<br/>
<br/>
<input name="borrow" type="radio" value="1000">Our $1,000
package at 8.0% interst
<br/>
<input name="borrow" type="radio" value="5000">Our $5,000
package at 11.5% interst
<br/>
<input name="borrow" type="radio" value="10,000">Our $10,000
package at 15.0% interst
<br/>
<br/>
<input name="submit" type="submit" value="Click here to Submit
application">
<input name="reset" type="reset" value="Reset application form">
</form>
</body>
</html>
AND
Calculate distance based on lat. long
<html>
<head>
<title>Document</title>
</head>
<?php
if( $_POST['Submit']){
$distance = distance($_POST[LAT1], $_POST[LONG1], $_POST[LAT2],$_POST[LONG2]);
}
function distance($Aa, $Ba, $Ca, $Da){
// this is just some basic error checking i'd normally put it into a seperate file but
// for the purposes of this file... well you know.
$input = array($Aa, $Ba, $Ca, $Da);
foreach($input as $name){
if (ereg("[[:alpha:]]",$name)){
echo "You cannot enter letters into this function<br>\n";
die;
}
if(ereg("\.",$name)){
$dot = ".";
$pos = strpos($name, $dot);
//echo $pos." <br>\n";
if($pos > 3){
echo "The input cannot exceed more than 3 digits left of the
decimal<br>\n";
die;
}
}
if($name > 365){
echo "The input cannot exceed 365 degrees <BR>\n";
die;
}
}
$A = $Aa/57.29577951;
$B = $Ba/57.29577951;
$C = $Ca/57.29577951;
$D = $Da/57.29577951;
//convert all to radians: degree/57.29577951
if ($A == $C && $B == $D ){
$dist = 0;
}
else if ( (sin($A)* sin($C)+ cos($A)* cos($C)* cos($B-$D)) > 1){
$dist = 3963.1* acos(1);// solved a prob I ran into. I haven't fully analyzed it yet
}
else{
$dist = 3963.1* acos(sin($A)*sin($C)+ cos($A)* cos($C)* cos($B-$D));
}
return ($dist);
}
?>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<p>Point one Lat
<input type="text" name="LAT1" value="<?=$_POST[LAT1]?>"
>
Long
<input type="text" name="LONG1"
value="<?=$_POST[LONG1]?>">
</p>
<p>Point two Lat
<input type="text" name="LAT2"
value="<?=$_POST[LAT2]?>">
Long
<input type="text" name="LONG2"
value="<?=$_POST[LONG2]?>">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<? echo "<br>distance = ".$distance." miles (as the crow
flies)<br>"; ?>
</body>
</html>
----
Server IP: 113.20.13.217
Probable Submitter: 122.108.33.226
----
Manual Page -- http://www.php.net/manual/en/function.strlen.php
Edit -- https://master.php.net/note/edit/108837
Del: integrated -- https://master.php.net/note/delete/108837/integrated
Del: useless -- https://master.php.net/note/delete/108837/useless
Del: bad code -- https://master.php.net/note/delete/108837/bad+code
Del: spam -- https://master.php.net/note/delete/108837/spam
Del: non-english -- https://master.php.net/note/delete/108837/non-english
Del: in docs -- https://master.php.net/note/delete/108837/in+docs
Del: other reasons-- https://master.php.net/note/delete/108837
Reject -- https://master.php.net/note/reject/108837
Search -- https://master.php.net/manage/user-notes.php