Advertisement
Advertisement
| 04.22.2008 at 09:11PM PDT, ID: 23345450 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: |
<?php
// Open database connection
$conn = mysql_connect('localhost', 'sanderan_usernam', 'password') or die("Unable to connect, the reason is: " . mysql_error());
mysql_select_db('sanderan_test') or die("Could not select database, the reason is: " . mysql_error());
// Pick up the form data and assign it to variables (if it was submitted)
if ($_POST['Status'] == '1') {
$name = $_POST['name'];
$short_info = $_POST['short_info'];
$description = $_POST['description'];
// Insert data
$query = "INSERT INTO my_new_table ('name', 'short_info', 'description')
VALUES ('$name', '$short_info', '$description')";
mysql_query($query);
// Close connection
mysql_close($conn);
// Redirect
header("Location: success.html");
}
?>
|