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>
UTL File problem
Hi
Help Ordering Arrays
Hi, I have 3 arrays as shown below.Code: $users = $this->get_latest_users();$flirt = $this->get_latest_flirts();$hotlist = $this->get_latest_hotlist();These arrays for a key have
explode() function problem maybe
Hi I'm having trouble searching my database. When I type two words in the search field it only searches for the second word. For example: if I typed london zoo , it will only search for zoo.Is this
pls clear my confusion
Hi friends,Pls solve my query .what is the exact use of Scope Resolution Operator( in classes.
How do i do multi uploads?.
Hey i would like to do this : http://hosting.mrkrabz.net/I've got the base down you can upload single files, But how would i make it so when you click a button it adds a new field for a file to be
How to display value in drop down list after form has been reloaded
Please bear with me as I am very new to php and html.I have a form with several drop down menus, the one at the top shows a list that when an item is selected fills in the form below including the
Posting to another Site?
I have software that people install.When they install it, is there a way to make it post their domain name to my website?I know I could do a header('location: http//www.mysite.com/id=?domain.com');
mysql VARCHAR acting like INT
Hi, All.I have a table that contains a varchar(10) column named weird_field. In this column, only integers reside (e.g., 3010101009). When I do this:Line number On/Off | Expand/Contract select *
When file included, REMOTE_ADDR is server's?
I have an index file that handles my site, basically index.php?page=ip will activate "require('./ip.php')".In the included file I have $ip = $_SERVER['REMOTE_ADDR']; and when it FIRST
string to currency format
Hi guys...Actually I chunk out some data from txtfile and one of the data contains amount value but in string format like so.."000000010000" -->desire result