My goal is to have info from a database echoed out and then available to be purchased by pressing a button. The info is being echoed properly but when the button is pressed it adds the $cost variable up for all of the qualifying variable vs the single one that it should be attached to... hopefully that makes sense.
Also, when I refresh the page the "credits" are deducted from the users account, I was under the impression that a button would stop this from happening...
$get = mysql_query("SELECT * FROM ac WHERE state='Alabama' ORDER BY datetime DESC LIMIT $start, $per_page");
while ($row = mysql_fetch_assoc($get))
$cost = $row['cost'];
$submit = $_POST['submit'];
$option2 = "../../buycredits.php";
$option2 = "ac_alabama.php";
$deduct = mysql_query("UPDATE users SET credits=credits-$cost WHERE username='$username'");
$option2 = "home.html";
<form action='$option2' method='POST'>
<input type='submit' name='submit' value='Purchase'>
Any and all help is greatly appreciated!
Thanks in advance.