mardi 3 mars 2015

Stop form from refreshing on submit

I've got this problem that the form refreshes on submit, i dont really want that. any of you know what i could do ?


click this link to an older post about this.



<div class="row text-center">
<?php
$sql = "SELECT * FROM radio";

$stmt = $Db->dbh->prepare($sql);
$stmt->execute();

$result = $stmt->fetchAll();

if(isset($_POST['submitRadio'])):
$test = $_POST['submitRadio'];
echo $test;
else:
echo 'error';
endif;

?>

<form method="post">

<?
foreach($result as $radio):

printf('

<button type="submit"
href="#radio"
name="submitRadio"
value="'.$radio['id'].'">
Go!
</button>

');
endforeach;
?>

</form>
</div>

Aucun commentaire:

Enregistrer un commentaire