Elementary Problem
| From: | php at erars dot demon dot co dot uk | Date: | Mon, 21 Oct 2002 21:38:35 +0000 |
| Subject: | Elementary Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120808@lists.php.net to get a copy of this message | ||
I have recently moved one php app from one server to another, it is working fine on one system but
has thrown up several errors on the new one. I am convinced that it is a simple fault but I just
can't see it.
These are the errors I get:
--------------------------------------------------------------------------------
Notice: Undefined variable: articleId in C:\phpweb\submitnews.php on line 27
Notice: Undefined variable: title in C:\phpweb\submitnews.php on line 27
Notice: Undefined variable: content in C:\phpweb\submitnews.php on line 27
Article Uploaded:
Notice: Undefined variable: title in C:\phpweb\submitnews.php on line 31
This is the submitnews.php script:
<html>
<body>
<title> Add Item to Testhouse Databases</title>
<style>
body { color:#000000; font-family: Verdana; font-size:9pt }
th { color:#FFFFFF; font-family: Verdana; font-size:9pt }
td { color:#000000; font-family: Verdana; font-size:8pt }
a { color:#000000; font-family: Verdana; font-size:8pt; font-weight: bold; }
</style>
<img src="testhouse.gif">
</head>
<body bgcolor="#C2D7EA">
<h2>Results:-</h2>
<hr noshade size="1" color="#20158F">
<?php
mysql_connect ("localhost");
mysql_select_db ("content");
mysql_query("INSERT INTO articles(articleId, title, content)
VALUES ('$articleId', '$title', '$content')");
print("Article Uploaded:");
print($title);
print("<p>");
?>
</body>
</html>
What is strange is that an articleID is actually added but nothing else even though it says that
articleId is undefined.
This the form script where the data is added from:
<html>
<head>
<title> Upload a News Article </title>
</head>
<body bgcolor="#FFFFFF">
<a href="http://www.testhouse.org.uk">
<img border="0" src="testhouse.gif">
</a>
<form action="submitnews.php" name="post">
<input type="hidden" name="articleId" value="NOT NULL">
<table border="0" cellpadding="0" cellspacing="0"
bordercolor="#111111" width="100%">
<tr>
<td width="100%" bgcolor="#999999" height="22"
colspan="2">
<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">
Upload a News Article</font></b></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFE300" height="22"
colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">
</font></b></td>
</tr>
<tr>
<td width="15%" bgcolor="#FFE300">
<p style="margin-left: 10"><font face="Verdana" size="2">
Article Title:</font></td>
<td width="85%" bgcolor="#FFE300">
<input type="text" name="title" size="20"
maxlength="20"></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFE300" height="22"
colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">
</font></b></td>
</tr>
<tr>
<td width="15%" bgcolor="#FFE300">
<p style="margin-left: 10"><font face="Verdana" size="2">
Article Body:</font></td>
<td width="85%" bgcolor="#FFE300">
<textarea name ="content" rows=16 cols=60 input type="text"
name="content"></textarea></td>
</tr>
<tr>
<td width="15%" bgcolor="#FFE300">
<p style="margin-left: 10"><font face="Verdana" size="2">
</font></td>
<td width="85%" bgcolor="#FFE300">
<br>
<input type="submit" name="submit" value="Publish"></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFE300" height="22"
colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">
</font></b></td>
</tr>
<tr>
<td width="100%" bgcolor="#999999" height="22"
colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">
</font></b></td>
</tr>
</table>
</form>
</body>
</html>
Thanks in advance for any help or direction.