Dear all;
I write a HTML form that ask user to post an announcement, the subject and body must be inserted into DB. But the problem that I face is the data is not inserted.
Any body can help me please to tell me what is the error.
Thanks.
Here are my code.[php]<?php
$host = "localhost";
$user = "";
$password = "";
$db = "e-school";
$table = "announcement";
mysql_connect($host,$user,$password) or die("The connection the the specified DataBase is failed. Please try again!");
mysql_select_db($db);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="ar-sa">
<title>POSTING ANNOUNCEMENT</title>
</head>
<body>
<?php
if (isset("submit")) {
$subject = $_POST['subject'];
$body = $_POST['body'];
$date = "20/4/2008";
$sql = "INSERT INTO $table VALUES('$subject', '$body', '$date')";
if (!mysql_query($sql)) {
die('ERROR..');
}else{
echo "Successfull... ";
}
mysql_close($con);
}else{
?>
<form action="" method="POST" >
<dl>
<dd>
<p dir="rtl"><b><span lang="ar-ae"><font size="4" color="#800000">
Subject </font></span></b></dd>
<dd>
<p dir="rtl"><font size="4" color="#800000">
<input size="54" maxlength="256" name="subject" style="font-size: 12pt; font-family: Times New Roman"></font></dd>
</dl>
<p dir="rtl"><b><span lang="ar-ae"><font size="4" color="#800000">Body:</font></span></b></p>
<dl>
<dd>
<p dir="rtl"><font size="4" face="Times New Roman" color="#0000FF">
<textarea name="body" rows="10" cols="57" style="font-size: 12pt; font-family: Times New Roman" dir="rtl"></textarea></font></dd>
</dl>
<p dir="rtl"><font color="#800000" size="4">
<input type="submit" value="Submit" name="submit" style="font-size: 12pt"></font><b><font size="4" color="#800000">
</font></b><font size="3" color="#800000">
<input type="reset" value="Reset" name="clear" style="font-size: 12pt"></font></p>
</form>
<?php
}
?>
</body>
</html>[/php]
4 1565 WARNING:
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use [code] tags in future.
MODERATOR
Only way to find ouit what is the error is to display the MySQL return error messge when an error occurs, like[php]die('ERROR..' . mysql_error());[/php]You'd better do that with all your MySQL statement executions, so you don't have to ask.
Ronald
Only way to find ouit what is the error is to display the MySQL return error messge when an error occurs, like[php]die('ERROR..' . mysql_error());[/php]You'd better do that with all your MySQL statement executions, so you don't have to ask.
Ronald
Dear;
Thank you for your replay, but the problem is that no data entry in My database?
I don't know why?
Could you please guide me?
Thank you alot
Dear;
Thank you for your replay, but the problem is that no data entry in My database?
I don't know why?
Could you please guide me?
Thank you alot
Please ignore if this may sound stupid, i dont do php. Why is your [HTML]<form action="">[/HTML] blank?.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sans Spam |
last post by:
Greetings! I have a table that contains all of the function
permissions within a given application. These functions are different
sections of a site and each has its own permissions (READ, WRITE,...
|
by: Mark P |
last post by:
Some time ago I posted here about inserting into a set with a hint:
...
|
by: pk |
last post by:
Sorry for the piece-by-piece nature of this post, I moved it from a
dormant group to this one and it was 3 separate posts in the other
group. Anyway...
I'm trying to bulk insert a text file of...
|
by: Philip Boonzaaier |
last post by:
I want to be able to generate SQL statements that will go through a list of
data, effectively row by row, enquire on the database if this exists in the
selected table- If it exists, then the colums...
|
by: robert |
last post by:
been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.
i assume that there is a threshold on the number of columns of
the...
|
by: authorking |
last post by:
I use the following code to insert a data record in to a datatable of an
access database.But every time I execute the command, there will rise an
exception and the insert operation can't be...
|
by: Polyhedron_12 |
last post by:
I am having problems calling functions in general in VB. I keep
getting alot of errors. Can anybody help me out with this? I put the
error message on the same line that it says it is at. I believe...
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :...
|
by: wombat53 |
last post by:
Hi Group
Are there any DB2 UDB ESE DPF V8.2 users exploiting "buffered inserts"
(BIND parm INSERT BUF) *and* "multi-row INSERTS" (many rows associated
with the VALUES clause of the INSERT to...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |