<html>
<body>
<?php if(isset($addvalues)): ?>
<form action="<?php echo($PHP_SELF); ?>" method=post>
Enter ur username:<input type="text" name="username" />
<input type="submit" value="submit" name="addname" />
</form>
<?php else:
$conn=mysqli_connect("localhost","root","","cars");
if(!$conn){
echo "Not Connected";
exit();
}else{
echo "Connected"."<br />";
}
if("submit" == $_POST['addname']){
$sql="insert into login set"."username='$username'";
if(mysqli_query($sql)){
echo "Added";
}else{
echo "Not Added";
}
}
if(isset($deletevalues)){
$sql="delete from login where id=$deletename";
if(mysqli_query($sql)){
echo "the joke has been deleted";
}else{
echo "errordeleting";
}
}
////////////////////////////////////////////////////////////////
echo "Here all the jokes in the database"."<br />";
$result=mysqli_query($conn,"select id ,username from login ");
if(!$result){
echo "no results found";
}
while($row=mysqli_fetch_array($result)){
$id=$row["id"];
$username=$row["username"];
echo ("$id"."-"."$username"."<a href='$PHP_SELF?deletevalues=$id'"."delete this username"."<br />");
}
endif ?>
بتدينيى
اقتباس
and when i click on maha it gives me teh same page again
why???
this exaple was written in a book
thnx in advance