het onderstaande update script werkt niet, hij geeft de volgende foutmeldingen:
Notice: Undefined variable: submit in C:\wamp\www\PROJECT IND\edit.php on line 54
Notice: Undefined index: in C:\wamp\www\PROJECT IND\edit.php on line 54
en wanneer submit knop is ingedrukt verschijnen de volgende meldingen:
Notice: Undefined index: cmd in C:\wamp\www\PROJECT IND\edit.php on line 29
Notice: Undefined index: voornaam in C:\wamp\www\PROJECT IND\edit.php on line 56
Notice: Undefined index: achternaam in C:\wamp\www\PROJECT IND\edit.php on line 57
Notice: Undefined index: straatnaam in C:\wamp\www\PROJECT IND\edit.php on line 58
Kan iemand die hier handig mee is mij hier mee helpen, ik ben niet heel handig met php, dus het zou mooi zijn als ik het ook begreep
Alvast bedankt voor de hulp!
Gert-Jan
_______________________________________________________________
<?php
//connect to mysql
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Krijgt geen verbinding: ' . mysql_error());
}
mysql_select_db("252109", $con);
//If cmd has not been initialized
if(!isset($cmd))
{
//Laat alle contacten zien
$result = mysql_query("SELECT * FROM parti_cont order by id");
//run the while loop that grabs all the news scripts
while($r=mysql_fetch_array($result))
{
//grab the title and the ID of the news
$title=$r["voornaam"];//take out the title
$id=$r["id"];//take out the id
//make the title a link
echo "<a href='edit.php?cmd=edit&id=$id'>$title - Edit</a>";
echo "<br>";
}
}
?>
<?php
if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
if (!isset($_POST["submit"]))
{
$id = $_GET["id"];
$sql = "SELECT * FROM parti_cont WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form action="aanpassen_bedrijf6.php" method="post">
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
Voornaam:<INPUT TYPE="TEXT" NAME="Voornaam" VALUE="<?php echo $myrow["voornaam"] ?>" SIZE=30><br>
Achternaam:<INPUT TYPE="TEXT" NAME="Achternaam" VALUE="<?php echo $myrow["achternaam"] ?>" SIZE=30><br>
Straatnaam:<INPUT TYPE="TEXT" NAME="Straatnaam" VALUE="<?php echo $myrow["straatnaam"] ?>" SIZE=30><br>
<input type="hidden" name="cmd" value="edit">
<input type="submit" name="submit" value="submit">
</form>
<?php } ?>
<?php
if ($_POST["$submit"])
{
$voornaam = $_POST["voornaam"];
$achternaam = $_POST["achternaam"];
$straatnaam = $_POST["straatnaam"];
$sql = "UPDATE news SET voornaam='$voornaam',achternaam='$achternaam',straatnaam='$straatnaam' WHERE id=$id";
//replace news with your table name above
$result = mysql_query($sql);
echo "Thank you!.";
}
}
?>
knop om je tekst aan te passen.