Skip to content

Instantly share code, notes, and snippets.

/sell controller Secret

Created August 5, 2014 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/67f92c6d5f3ea1cde68a to your computer and use it in GitHub Desktop.
Save anonymous/67f92c6d5f3ea1cde68a to your computer and use it in GitHub Desktop.
<?php
require("../includes/config.php");
$rows = query("SELECT * FROM Stock WHERE id = ?", $_SESSION["id"]);
foreach ($rows as $row)
{
$positions[] = ["symbol" => $row["symbol"]];
}
query("DELETE FROM Stock WHERE id = ? AND symbol = ?", $_SESSION["id"], $_POST["menu"]);
render("sell.php", ["positions" => $positions, "title" => "Sell"]);
?>
<div id=sell>
<fieldset>
<form name="menu" action="sell.php" method="POST">
<select>
<?php foreach ($positions as $position): ?>
<option value="<?= $position["symbol"]?>"><?= $position["symbol"] ?> </option>
<?php endforeach ?>
</select>
<button type="submit" class="btn btn-default">Sell</button>
</form>
</fieldset>
</div>
<div>
<a href="/">Home</a>
<div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment