vendredi 8 mai 2015

PHP - return to another page using header

I was trying to update data in database using oop php but after I call function update I should return the user to view all page , so i used header but then whenever i try to view update page, it views view all page. what should i do?

<body>

    <form  method='POST'>
<table>
<tr>
<td>id</td>
<td>
<input type='text' name='id' value='' ></td>
</tr>
<tr>
<td>price</td>
<td>
<input type='text' name='price' value='' ></td>
</tr>
<tr>
<td></td>
<td>
<input type='submit' name='commit' value='Submit'>
</td>
</tr>

</table>
</form> 
</body>
</html>

<?php
require_once ('database.php');
require_once ('admin.php');
$object= new admin();
if (isset($_POST['commit'])) {
$id    = $object->clean($_POST['id']);
$price = $object->clean($_POST['price']);
$object->update_sport($id ,$price);
}
header("C:\wamp\www\omnia\viewsports.php");

Aucun commentaire:

Enregistrer un commentaire