Hey people,
a simple form to submit things to my database is proving to be more difficult than i had hoped.
The form looks something like this:
And the toevoegen.php file looks like this:
The scoutwrite.php file holds my connection variables:
The form adds rows to my table with the desired data in them, but my browser goes -and stays- at toevoegen.php when i press the send buttonw of my form. How do i fix this? I tried a <?php header("location:index.php"); ?> but that gives an error.
a simple form to submit things to my database is proving to be more difficult than i had hoped.
The form looks something like this:
| Code: |
|
<form action="toevoegen.php" method="POST"> Title<input size="50" maxlength="250" type="text" name="titel"><br /> Message<input size="50" maxlength="250" type="text" name="message">< br /> By<input size="50" maxlength="250" type="text" name="by"><br /> <input type="Submit" name="send" value="Add"> <input type="Reset" value="clear"> </form> |
And the toevoegen.php file looks like this:
| Code: |
|
<?php include('Connections/scoutwrite.php'); $scoutwrite = mysql_pconnect($hostname_scoutwrite, $username_scoutwrite, $password_scoutwrite) or trigger_error(mysql_error()); mysql_select_db($database_scoutwrite) or die ("Kan geen database selecteren!"); $query = "INSERT INTO $tabel_scoutwrite (title, message, by) VALUES ('" . $_POST['title'] . "', '" . $_POST['message'] . "', '" . $_POST['by']."', '"; mysql_query($query); mysql_close(); ?> |
The scoutwrite.php file holds my connection variables:
| Code: |
| <?php
$hostname_scoutwrite = "localhost"; $database_scoutwrite = "rein_scouts"; $username_scoutwrite = "rein_main"; $password_scoutwrite = "*******"; $tabel_scoutwrite = "berichten"; ?> |
The form adds rows to my table with the desired data in them, but my browser goes -and stays- at toevoegen.php when i press the send buttonw of my form. How do i fix this? I tried a <?php header("location:index.php"); ?> but that gives an error.
