Skip to content

Instantly share code, notes, and snippets.

@oflarcade
Created March 28, 2016 18:32
Show Gist options
  • Save oflarcade/c498975cc06ad422963e to your computer and use it in GitHub Desktop.
Save oflarcade/c498975cc06ad422963e to your computer and use it in GitHub Desktop.
<?php
$studentN= array('omar');
$studentS= array('lakhdhar');
$studentID=array('07011141');
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST"){
if (isset($_REQUEST['add'])) {
echo "this is add";
Add();
} elseif (isset($_REQUEST['update'])) {
echo "this is update";
update();
}
elseif (isset($_REQUEST['delete'])) {
echo "this is delete";
Delete();
}
}
function update(){
}
function Delete(){
}
function Add(){
array_push($studentN,$_POST["name1"]);
array_push($studentS,$_POST["sname1"]);
array_push($studentID,$_POST["sid1"]);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Omar Farouk Lakhdhar</title>
<link rel="stylesheet" href="./css/style.css" type="text/css" />
<link rel="stylesheet" href="./css/responsive.css" type="text/css" />
</head>
<body>
<header>
<div id="banner" role="banner">
<img src="images/Banner.png" alt="logo"/>
</div>
<div id="newsletter-box">
<form name="newsletter-form" action="#" method="post">
<label for="newsletter-email">Newsletter:</label>
<input type="email" id="newsletter-email" class="newsletter-email" name="email" required="required" placeholder="Your email" />
<input type="submit" name="submit" value="Submit" />
</form>
</div>
</header>
<nav class="menu">
<ul class="menu-list">
<li class="menu-item">
<a class="menu-item-link" href="./index.html" title="Homepage">Homepage</a>
</li>
<li class="menu-item">
<a class="menu-item-link" href="./CV.html" title="News">CV</a>
</li>
<li class="menu-item">
<a class="menu-item-link" href="./Homework.html" title="Graphics">HomeWork</a>
</li>
<li class="menu-item">
<a class="menu-item-link" href="./contact.html" title="Mobile">Contact</a>
</li>
<script>
$("#menu-select").change(function(){
window.location.href = $(this).children("option:selected").val();
});
</script>
<select id="menu-select">
<option selected="selected" value="/">Homepage</option>
<option value="/cv">CV</option>
<option value="/Homework">HomeWork</option>
<option value="/contact">Contact</option>
</select>
<li class="stretch">
</li>
</ul>
</nav>
<div id="pageCenter">
<h1>Student Table Form</h1>
</div>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<table class="table">
<tr>
<th class="tr" >Student Name</th>
<th class="tr">Student Surname</th>
<th class="tr">Student ID</th>
</tr>
<tr>
<td>
<input type="text" value="<?php echo $studentN[0];?>" name="name"/>
</td>
<td>
<input type="text" value="<?php echo $studentS[0];?>" name="sname"/>
</td>
<td>
<input type="text" value="<?php echo $studentID[0];?>" name="sid"/>
</td>
</tr>
<tr>
<td>
<input type="text" value="<?php echo $studentN[1];?>" name="name1"/>
</td>
<td>
<input type="text" value="<?php echo $studentS[1];?>" name="sname1"/>
</td>
<td>
<input type="text" value="<?php echo $studentID[1];?>" name="sid1"/>
</td>
</tr>
<tr>
<td>
<input type="text" value="<?php echo $studentN[2];?>" name="name2"/>
</td>
<td>
<input type="text" value="<?php echo $studentS[2];?>" name="sname2"/>
</td>
<td>
<input type="text" value="<?php echo $studentID[2];?>" name="sid2"/>
</td>
</tr>
<tr>
<td>
<input type="text" value="<?php echo $studentN[3];?>" name="name3"/>
</td>
<td>
<input type="text" value="<?php echo $studentS[3];?>" name="sname3"/>
</td>
<td>
<input type="text" value="<?php echo $studentID[3];?>" name="sid3"/>
</td>
</tr>
</table>
<input type="submit" value="Add" name="add"/> <input type="submit" value="Delete" name="delete"/> <input type="submit" value="Update" name="update"/><select name="index"><option value="0">0</option>
<option value="0">1</option><option value="0">2</option><option value="0">3</option></select>*select index to update
</form>
<footer id="main-footer">
<p>
Omar Farouk Lakhdhar. All rights reserved. Copyright &copy; 2015 - 2016.
</p>
<div class="social-bar">
<a href="./facebook" title="Facebook">
<img src="./images/icons/facebook.png" alt="Facebook icon" />
</a>
<a href="./twitter" title="Twitter">
<img src="./images/icons/twitter.png" alt="Twitter icon" />
</a>
<a href="./googleplus" title="Google+">
<img src="./images/icons/google.png" alt="Google+ icon" />
</a>
<a href="./linkedin" title="LinkedIn">
<img src="./images/icons/linkedin.png" alt="Linkedin icon" />
</a>
</div>
</footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment