View Single Post
 
Old January 4th, 2005, 03:41 PM
leno leno is offline
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here some updated code, which doesn't give any errors, but it also doesn't seem to work. No values are put in my local db...

[code]
<?php
// When submit button is pressed
if(isset($sbm)==1) {
?>
<script type="text/javascript">
// Read names and e-mail address from POSTED form
naam = "<?php echo $_POST['name']; ?>"
email = "<?php echo $_POST['email']; ?>"

// Connect to MySQL
document.write('<?php echo "<?php \$db = mysql_connect(\"localhost\", \"jeugdavanti\", \"stifmeister\") or die (\"Vautje!\");')
document.write('mysql_select_db(\"avanti\", \$db);')
document.write('\$query = \"INSERT INTO namen (naam, email) VALUES (\"', naam, '\", \"', email, '\")\";')
document.write('mysql_query(\$query);')
document.write('mysql_close(); ?>"; ?>')
document.write('Het is gelukt!')
</script>
<?php
} else {
?>
<form method="post" action="db.php" name="formulier">
<input name="name"> Je naam<br>
<input name="email"> Je email<br>
<input type="submit" name="sbm" value="Invoegen"></form>
<?php
}
?>[code]

Some variables and other stuff are named in Dutch... but that shouldn't be a problem for you guys...

Any solutions? Try the script if you want, it just displays the confirmation ("Het is gelukt!") but nothing is inserted into the db. Maybe it is something with the variables