mercredi 23 octobre 2013

how to update 1 fields using button


eto po code ko.. pag click ko sa button ayaw mag set yung status field nya sa 1..


<?php


mysql_connect ("localhost","root","") or die ("Couldn't Connect");


mysql_select_db ('alumnimpc') or die ("Couldn't Connect");


$sql = "SELECT * FROM login WHERE status='0'";

$result = mysql_query($sql);


?>


<html>

<head>

<title>Untitled Document</title>

</head>

<h1>

New Registered Alumni

</h1>

<p>

<a href="indexadmin.php"> Home </a>


<body>

<table border="1">

<?php


//echo "List of Users";


echo "<table border='1' align='center' width='600' bgcolor='#999999'>

<tr>

<th>Alumni ID</th>

<th>Fullname</th>

<th>Email Address</th>

<th>Contact</th>

<th>Status</th>

</tr>";


while ($row = mysql_fetch_array($result)){

echo "<tr>";

echo "<td>".$row['fullname']."</td>";

echo "<td>".$row['username']."</td>";

echo "<td>".$row['emailadd']."</td>";

echo "<td>".$row['contact']."</td>";

if($fetch["status"] == 0){

echo "<form action='newalumni.php' method='post'>

<td><input type='submit' name='activate' value='Activate'>

<input type='hidden' name='activate' value='id'</td>

</form>";

if (isset($_POST['1'])){


$sql = "UPDATE login SET status='1' WHERE id='$id'"


or die(mysql_error());

//header("Location:indexadmin.php");

}

}

echo "</tr>";

}

echo "</table>";


mysql_close();


?>

</body>

</html>







via Symbianize Forum http://www.symbianize.com/showthread.php?t=1071759&goto=newpost

Aucun commentaire:

Enregistrer un commentaire