Hoi allemaal,
ik heb een form gemaakt (of een poging tot gedaan) om vacatures te posten in een database.
dit werkte hartsikke goed. Nu wil ik bij het invulregeltje doel een textvak hebben en niet 1 regel link:
http://weevers-concept.nl/leon/addvacature.php
hieronder de code
<html>
<head>
<title>Een nieuwe vacature toevoegen</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" class="nieuws" background="backlijn.gif" leftmargin="20" topmargin="20" marginwidth="20" marginheight="20">
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("vacatures",$db);
if ($submit) {
// here if no ID then adding else we're editing
if ($id) {
$sql = "PRINT vacatures SET titel='$titel', WHERE id=$id";
} else {
$sql = "INSERT INTO vacatures (titel) VALUES ('$titel')";
}
// run SQL against the DB
$result = mysql_query($sql);
echo "<center>Vacature Toegevoegd!</A></A><p>";
} elseif ($delete) {
// delete a record
$sql = "DELETE FROM vacatures WHERE id=$id";
$result = mysql_query($sql);
echo "$sql Vacature weggehaald!<p>";
} else {
// this part happens if we don't press submit
if (!$id) {
// print the list if there is not editing
$result = mysql_query("SELECT * FROM vacatures",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<center><a href=\"%s?id=%s\">%s </a> \n", $PHP_SELF, $myrow["id"], $myrow["titel"]);
printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, $myrow["id"]);
}
}
?>
<P>
<a href="<?php echo $PHP_SELF?>">Vacature Toevoegen</a>
<P>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
if ($id) {
// editing so select a record
$sql = "SELECT * FROM vacatures WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$titel = $myrow["titel"];
$doel = $myrow["doel"];
// print the id for editing
?>
<input type=hidden name="id" value="<?php echo $id ?>">
<?php
}
?>
Functie : <input type="Text" titel="titel" value=<?php echo $titel ?><br>
Doel : <input type="Text" doel="doel" value=<?php echo $doel ?><br>
<center><input type="Submit" name="submit" value="Vacature Toevoegen">
</form>
<?php
}
?>
<center> Copyright 2001-2002 <A HREF="http://www.ruumpol.com">By Ruumpol Design</A>
</body>
</html>
ik heb een form gemaakt (of een poging tot gedaan) om vacatures te posten in een database.
dit werkte hartsikke goed. Nu wil ik bij het invulregeltje doel een textvak hebben en niet 1 regel link:
http://weevers-concept.nl/leon/addvacature.php
hieronder de code
<html>
<head>
<title>Een nieuwe vacature toevoegen</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" class="nieuws" background="backlijn.gif" leftmargin="20" topmargin="20" marginwidth="20" marginheight="20">
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("vacatures",$db);
if ($submit) {
// here if no ID then adding else we're editing
if ($id) {
$sql = "PRINT vacatures SET titel='$titel', WHERE id=$id";
} else {
$sql = "INSERT INTO vacatures (titel) VALUES ('$titel')";
}
// run SQL against the DB
$result = mysql_query($sql);
echo "<center>Vacature Toegevoegd!</A></A><p>";
} elseif ($delete) {
// delete a record
$sql = "DELETE FROM vacatures WHERE id=$id";
$result = mysql_query($sql);
echo "$sql Vacature weggehaald!<p>";
} else {
// this part happens if we don't press submit
if (!$id) {
// print the list if there is not editing
$result = mysql_query("SELECT * FROM vacatures",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<center><a href=\"%s?id=%s\">%s </a> \n", $PHP_SELF, $myrow["id"], $myrow["titel"]);
printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, $myrow["id"]);
}
}
?>
<P>
<a href="<?php echo $PHP_SELF?>">Vacature Toevoegen</a>
<P>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
if ($id) {
// editing so select a record
$sql = "SELECT * FROM vacatures WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$titel = $myrow["titel"];
$doel = $myrow["doel"];
// print the id for editing
?>
<input type=hidden name="id" value="<?php echo $id ?>">
<?php
}
?>
Functie : <input type="Text" titel="titel" value=<?php echo $titel ?><br>
Doel : <input type="Text" doel="doel" value=<?php echo $doel ?><br>
<center><input type="Submit" name="submit" value="Vacature Toevoegen">
</form>
<?php
}
?>
<center> Copyright 2001-2002 <A HREF="http://www.ruumpol.com">By Ruumpol Design</A>
</body>
</html>