Sun Apr 10, 2011 4:51 pm
Mon Apr 11, 2011 5:21 am
Mon Apr 11, 2011 11:50 am
Mon Apr 11, 2011 12:39 pm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<html>
<head>
<title>Index</title>
</head>
<body>
<h2 align="center">MA Persons</h2>
<form name="forml" method="post" action="UserRegistrationFormOutput.php" enctype="multipart/form-data">
<table width="50%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="9%">Name:</td>
<td width="91%"><input type="text" name="name" size="100" maxlength="100">
</div>
</td>
</tr>
<tr>
<td width="9%"> Date of Birth:</td>
<td height="2"><input type="text" name="name2" size="100" maxlength="100" /></td>
</tr>
<tr>
<td width="9%" height="32">V Type:</td>
<td height="32"><input type="text" name="name3" size="100" maxlength="100" /></td>
</tr>
<tr>
<td width="9%">Begining with:</td>
<td height="2"><input type="text" name="name4" size="100" maxlength="100" /></td>
</tr>
<tr>
<td width="9%">Observations:</td>
<td height="2"><textarea name="address" cols="97" rows="4"> </textarea></td>
</tr>
<tr>
<td width="9%" height="5">Rejected:</td>
<td height="5"><textarea name="address2" cols="97" rows="4"> </textarea></td>
</tr>
<tr>
<td width="9%">Why</td>
<td height="2"><textarea name="address3" cols="97" rows="4"> </textarea></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Add person" />
<input type="submit" name="Submit2" value="Modify person" />
<input type="submit" name="Submit3" value="Delete person" />
<input type="submit" name="Submit4" value="Save file" />
<input type="submit" name="Submit5" value="Exit application" />
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
<body>
</body>
</html>
Sun Jul 17, 2011 6:26 pm
Radu wrote:I have the design but is not that simple.
I need to add multiple persons in one txt file
- Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<html>
<head>
<title>Index</title>
</head>
<body>
<h2 align="center">MA Persons</h2>
<form name="forml" method="post" action="UserRegistrationFormOutput.php" enctype="multipart/form-data">
<table width="50%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="9%">Name:</td>
<td width="91%"><input type="text" name="name" size="100" maxlength="100">
</div>
</td>
</tr>
<tr>
<td width="9%"> Date of Birth:</td>
<td height="2"><input type="text" name="name2" size="100" maxlength="100" /></td>
</tr>
<tr>
<td width="9%" height="32">V Type:</td>
<td height="32"><input type="text" name="name3" size="100" maxlength="100" /></td>
</tr>
<tr>
<td width="9%">Begining with:</td>
<td height="2"><input type="text" name="name4" size="100" maxlength="100" /></td>
</tr>
<tr>
<td width="9%">Observations:</td>
<td height="2"><textarea name="address" cols="97" rows="4"> </textarea></td>
</tr>
<tr>
<td width="9%" height="5">Rejected:</td>
<td height="5"><textarea name="address2" cols="97" rows="4"> </textarea></td>
</tr>
<tr>
<td width="9%">Why</td>
<td height="2"><textarea name="address3" cols="97" rows="4"> </textarea></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Add person" />
<input type="submit" name="Submit2" value="Modify person" />
<input type="submit" name="Submit3" value="Delete person" />
<input type="submit" name="Submit4" value="Save file" />
<input type="submit" name="Submit5" value="Exit application" />
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
<body>
</body>
</html>
<?php
$name = empty($_GET["name"]) ? "" : $_GET["name"];
$dateofbirth = empty($_GET["dateofbirth"]) ? "" : $_GET["dateofbirth"];
$vtype = empty($_GET["vtype"]) ? "" : $_GET["vtype"];
$beginingwith = empty($_GET["beginingwith"]) ? "" : $_GET["beginingwith"];
$observations = empty($_GET["observations"]) ? "" : $_GET["observations"];
$rejected = empty($_GET["rejected"]) ? "" : $_GET["rejected"];
$why = empty($_GET["why"]) ? "" : $_GET["why"];
if(!$name){$message1 = "Name.";}
if(!$dateofbirth){$message2 = "Date of Birth.";}
if(!$vtype){$message3 = "V Type.";}
if(!$beginingwith){$message4 = "Begining with.";}
if(!$observations){$message7 = "Observations.";}
if(!$rejected){$message5 = "Rejected.";}
if(!$why){$message6 = "Why.";}
?>
<html>
<head>
<title>Index</title>
</head>
<body>
<h2 align="center">MA Persons</h2>
<form method="post" action="store_it.php">
<table width="50%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="9%"><?php echo $message1; ?></td>
<td width="91%"><input type="text" name="name" size="100" maxlength="100" value="<?php echo $name; ?>">
</div>
</td>
</tr>
<tr>
<td width="9%"><?php echo $message2; ?></td>
<td height="2"><input type="text" name="dob" size="100" maxlength="100" value="<?php echo $dateofbirth; ?>"></td>
</tr>
<tr>
<td width="9%" height="32"><?php echo $message3; ?></td>
<td height="32"><input type="text" name="vtype" size="100" maxlength="100" value="<?php echo $vtype; ?>"></td>
</tr>
<tr>
<td width="9%"><?php echo $message4; ?></td>
<td height="2"><input type="text" name="bw" size="100" maxlength="100" value="<?php echo $beginingwith; ?>"></td>
</tr>
<tr>
<td width="9%"><?php echo $message7; ?></td>
<td height="2"><textarea name="ob" cols="97" rows="4" value="<?php echo $observations; ?>"> </textarea></td>
</tr>
<tr>
<td width="9%" height="5"><?php echo $message5; ?></td>
<td height="5"><textarea name="rej" cols="97" rows="4" value="<?php echo $rejected; ?>"> </textarea></td>
</tr>
<tr>
<td width="9%"><?php echo $message6; ?></td>
<td height="2"><textarea name="why" cols="97" rows="4" value="<?php echo $why; ?>"> </textarea></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Add person" />
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
<body>
</body>
</html>
<?php
$name = empty($_POST["name"]) ? "" : $_POST["name"];
$dob = empty($_POST["dob"]) ? "" : $_POST["dob"];
$bw = empty($_POST["bw"]) ? "" : $_POST["bw"];
$vtype = empty($_POST["vtype"]) ? "" : $_POST["vtype"];
$ob = empty($_POST["ob"]) ? "" : $_POST["ob"];
$rej = empty($_POST["rej"]) ? "" : $_POST["rej"];
$why = empty($_POST["why"]) ? "" : $_POST["why"];
if(!$name || !$dob || !$bw || !$vtype || !$ob || !$rej || !$why){header("location:index.php?name=$name&dateofbirth=$dob&beginingwith=$bw&vtype=$vtype&observations=$ob&rejected=$rej&why=$why");}
else
{
$file = "PhoneBook.txt";
$a = fopen($file, "a");
fwrite($a,$name."\r\n");
fwrite($a,$dob."\r\n");
fwrite($a,$vtype."\r\n");
fwrite($a,$bw."\r\n");
fwrite($a,$ob."\r\n");
fwrite($a,$rej."\r\n");
fwrite($a,$why."\r\n");
fclose($a);
$a = fopen($file, "r");
echo "<table border='1'>";
echo "<tr><th>Name</th><th>Date Of Birth</th><th>V-Type</th><th>Begining With</th><th>Observations</th><th>Rejected</th><th>Why</th></tr>";
while(!feof($a))
{
echo "<tr><td>".fgets($a)."</td><td>".fgets($a)."</td><td>".fgets($a)."</td><td>".fgets($a)."</td><td>".fgets($a)."</td><td>".fgets($a)."</td><td>".fgets($a)."</td></tr>";
}
echo "</table>";
fclose($a);
}
?>
Save Successfully!<br>
Want to add Another Entry? Click Add Another Button
<form action="index.php">
<input type="submit" value="Add another">
</form>
Tue Dec 20, 2011 3:32 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.