Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created March 12, 2020 12:08
Show Gist options
  • Save phpfiddle/26a7d83daa5edf2d53553185bffe53fc to your computer and use it in GitHub Desktop.
Save phpfiddle/26a7d83daa5edf2d53553185bffe53fc to your computer and use it in GitHub Desktop.
[ Posted by Zeusbeer ] fruitlijst try 2
<style>
label {
float:left;
display:block;
width:250px;
}
input{
display:block;
}
</style>
<html>
<form method="post" actions ="">
<label>fruit</label>
<input type = "text" name = "fruit">
<br>
<label>voeg fruit toe</label>
<input type = "submit" name = "verzenden">
</form>
</html>
<?php
session_start();
$array = array();
$_SESSION["fruit"] = "";
if(isset($_POST['verzenden']))
{
$_SESSION["fruit"] = $_POST['fruit'];
array_push($array, $_SESSION["fruit"]);
for($i = 0; $i < count($array); $i++)
{
echo $array[$i];
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment