Skip to content

Instantly share code, notes, and snippets.

/sell controller Secret

Created Aug 5, 2014
Embed
What would you like to do?
<?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