Hello Everyone
This is a basic script for posting to a database. I'm not sure why it doesn't work. Can anyone tell me why?
Code: [Select]<?php
require('config.php');
if(isset($_GET['id']) == TRUE && isset($_GET['td'])==TRUE){
if(is_numeric($_GET['id'])==FALSE || is_numeric($_GET['td'])==FALSE) {
$error = 1;
}
if($error == 1){
header("Location: " . $config_basedir);
}
else{
$validentry = $_GET['id'];
$validtd = $_GET['td'];
}
}
else{
$validentry = 0;
}
if($_POST['submit']) {
$db = mysql_connect($dbhost,$dbuser,$dbpassword);
mysql_select_db($dbdatabase, $db);
if(!$db){
die('FAILED TO OPEN DATABASE:' . mysql_error());
}
$sql = "INSERT INTO todo(id, topic, date, comment)
VALUES (" . $validentry . ", '" . $_POST['topic'] .
"', '" . $_POST['date'] . "', '" . $_POST['comment'] . "');";
$result=mysql_query($sql);
if(!$result){
die('FAILED TO INPUT INTO DATABASE:' . mysql_error());
}
header("Location: index.php?id=" . $validentry);
}
?>
<center>
**All dates must be inputted in the YYYY-MM-DD format**
<form action="<?php echo $SCRIPT_NAME . "?id=" . $validentry; ?>" method="post">
<table>
<tr>
<td>Topic</td>
<td><input type="text" name="topic"></td>
</tr>
<tr>
<td>Date</td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td>Comment</td>
<td><input type="text" name="address"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Submit Note"></td>
</tr>
</table>
</form>
</center>
Add trigger to UpdatePanel programmatically
Hi,I'm working on a website which uses AJAX and Masterpages. What I have is an AJAX UpdatePanel which contains the ContentPlaceHolder on the MasterPage.However, on one page I have a FileUpload
Implementing Single Sign-On using SAML 1.1, x.509, LDAP in C#.net
Hi,
socket communication between c++/java and sending image
hi, i have a class in c++ called win32_sockserver which creates socket to java. i am trying to send image c++ to java and using the most basic method. i am sending image's rgb values as a string. But
IIS & NW MII on the same server
Hi,
Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.When I send an email from an email account set up domain (using, for example, xxx@MyDomain.net) and then view the header
cyrillic string conversion question
Hello,
Why is the logic of this simple code not working?
Hey, I'm trying to determine if a table already exists in mysql, but doing a query first with mysql_query, then checking $sql as if it a were TRUE of FALSE. Which I though it would be. My Code
Batch Session SM35 stuck in status 'in Background
Hi Experts,
GET * FROM _____ Except?
I have a site that is for stock photography.This section of the code calls images to display on the main page, based on several variables (new images, featured images, most downloaded, highest rated,
Convert .fdf to .pdf
I currently have a web form that uploads the form data to an .fdf file and emails it.However, I just realized that most people I email it to cannot open an .fdf and it needs to be in pdf.Is there any