I am having a problem with inserting data into a table via a web form,
which was
working just fine prior to changing the port the web server is listening on
from 80
to 8080. I can insert data via the mysql command line just fine, just not
from the
web form. Below are the forms and table def for reference.
(freebsd4.2, apache 1.3.14, php4.0.3pl1, mysql Ver 11.15 Distrib 3.23.38,
for -freebsd4.2 (i386) )
--
Chip
This first one is the data input form...
--------------------------
<html>
<head>
<title>Dealer Bulletins - Simrad, Inc</title>
</head>
<body bgcolor="aqua">
<?
if(isset($submit)):
$db = mysql_connect("localhost", "root");
mysql_select_db("todaysnews", $db);
$date = date("Y-m-d");
$sql = "insert into bulletin values
(null,'$heading','$body','$bulletin_number','$bulletin_subject','$bulletin_from1','$bulletin_date','$bulletin_from2')";
mysql_query($sql);
print("<h2>The Data has been entered!</h2>\n");
print("<strong>You can add another Dealer Bulletin below</strong><br /><hr>\n");
endif;
?>
<table summary="" width="90%" border="0" cellpadding="5" cellspacing="0"
align="center">
<tr>
<td colspan="2">
<h2><center>Dealer Bulletins - Simrad, Inc</center></h2><br />
<hr align="center" noshade="noshade" width="50%" /><br />
<h3>Enter your Dealer Bulletin into the database</h3>
All fields can be changed if this will not be a Dealer Bulletin, otherwise, change
only where indicated.<br />
These fields match the header fields on the printed Dealer Bulletin.
<form action="bulletin_sorter.php" method="post">
</td>
</tr>
<tr>
<td valign="bottom">
Heading:<br />
<font size="-1">(Change only if necessary)</font><br />
<input type = "text" name="heading" value="Dealer Bulletin - " maxlength="48">
</td>
<td valign="bottom">
Bulletin Number:<br />
<font size="-1">(Change only the two center 0's)</font><br />
<input type = "text" name="bulletin_number" value="DB-00-01" maxlength="48">
</tr>
<tr>
<td colspan="2" valign="bottom">
Bulletin Subject:<br />
<font size="-1">If the subject is longer than 60 characters you can force it to wrap
with the following tag:<br /><br />
The br stands for break, so this will force a line break. Just type in that tag
wherever you want the line to break.</font><br />
<input type = "text" name="bulletin_subject" maxlength="64" size="60" value="Overwrite
this with the subject from printed Bulletin">
</td>
</tr>
<tr>
<td colspan="2" valign="bottom">
Bulletin From 1:<br /><select name="bulletin_from1">
<option value="Choose One">Choose One</option>
<option value="Tom Burke, Product Support Mgr - Autopilots & Instrumentation">Tom
Burke, Product Support Mgr - Autopilots & Instrumentation</option>
<option value="Brian Vlad, Product Support Mgr - Plotter & Radar Products">Brian vlad,
Product Support Mgr - Plotter & Radar Products</option>
<option value="Michael Hillers, Fisheries Mgr">Michael Hillers, Fisheries Mgr</option>
<option value="David Parkinson, National Sales Mgr">David Parkinson, National Sales
Mgr</option>
<option value="John Caballero, General Manager">John Caballero, General
Manager</option>
<option value="Brian Staton, President">Brian Staton, President</option>
<option value="Bruce Trimble, Operations Manager">Bruce Trimble, Operations
Manager</option>
<option value="Phil Roberts, Service Manager">Phil Roberts, Service Manager</option>
</select>
</td>
</tr>
<tr>
<td valign="bottom">
Bulletin Date:<br />
<font size="-1">(Change only the 0's [Mo-Day] )</font><br />
<input type="text" name="bulletin_date" value="00-00-2001" maxlength="15">
</td>
<td valign="bottom">
Bulletin From 2:<br /><select name="bulletin_from2">
<option value="Choose One">Choose One</option>
<option value="David Parkinson, National Sales Mgr">David Parkinson, National Sales
Mgr</option>
<option value="John Caballero, General Manager">John Caballero, General
Manager</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">Bulletin:<br />
<br />
<textarea cols="80" rows="20" name="body" wrap="virtual"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit" value="Submit!">
<input type="reset" name="reset" value="Start Over!">
</td>
</tr>
</table>
</form>
</body>
</html>
-------------------------------------------
Now the table def....
-----------------------------
mysql> describe bulletin;
+------------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default |
|Extra |
+------------------+-------------+------+-----+---------+----------------+
| news_id | int(11) | | PRI | NULL |
|auto_increment |
| heading | varchar(48) | YES | | NULL |
||
| body | text | YES | MUL | NULL |
| |
| bulletin_number | varchar(48) | YES | | NULL | |
| bulletin_subject | varchar(64) | YES | MUL | NULL | |
| bulletin_from1 | varchar(64) | YES | | NULL | |
| bulletin_date | varchar(15) | YES | | NULL | |
| bulletin_from2 | varchar(64) | YES | | NULL | |
+------------------+-------------+------+-----+---------+----------------+
-----------------------------
The bulletin display page...
-----------------------------
<html>
<head>
<title>Dealer Bulletins, Simrad, Inc</title>
</head>
<body bgcolor="#b5e4f9">
<center>
<h1>Simrad Dealer Bulletins</h1>
</center>
You can sort the bulletins in the following order:
<br />
<ul>
<li><a href="bulletin_sorter.php?orderby=date">Bulletin Date</a> (oldest to
newest)</li>
<li><a href="bulletin_sorter.php?orderby=date2">Bulletin Date</a> (newest to
oldest)</li>
<li>Select bulletins from <a href="bulletin_sorter.php?orderby=vlad">Brian Vlad</a> -
Plotter and Radar Products</li>
<li>Select bulletins from <a href="bulletin_sorter.php?orderby=burke">Tom Burke</a> -
Autopilots and Instrumentation</li>
<li>Select bulletins from <a href="bulletin_sorter.php?orderby=hillers">Mike
Hillers</a> - Fisheries</li>
</ul>
<br />
<hr width="75%" noshade="noshade">
<table summary="" border="0" cellpadding="1" align="center" width="90%">
<?
$db = mysql_connect("localhost", "root");
mysql_select_db("todaysnews", $db);
if ($orderby == 'date'):
$sql = "select * from bulletin order by 'bulletin_date'";
elseif ($orderby == 'date2'):
$sql = "select * from bulletin order by 'bulletin_date' desc";
elseif ($orderby == 'vlad'):
$sql = "select * from bulletin where bulletin_from1 like '%Vlad%' order by
'bulletin_number' desc";
elseif ($orderby == 'burke'):
$sql = "select * from bulletin where bulletin_from1 like '%Burke%' order by
'bulletin_number' desc";
elseif ($orderby == 'hillers'):
$sql = "select * from bulletin where bulletin_from1 like '%Hillers%' order by
'bulletin_number' desc";
else:
$sql = "select * from bulletin order by 'bulletin_date' desc";
endif;
$result = mysql_query($sql);
while ( $row = mysql_fetch_array($result))
if ($orderby == 'vlad' || $orderby == 'burke' || $orderby == 'hillers'
|| $orderby =='date' || $orderby == 'date2' || $search
== 'orderby'):
{
print("<tr>\n<td colspan=\"2\">\n<img src=\"1pixb5e4f9.gif\" alt=\"\"
height=\"20\" width=\"1\">\n</td>\n</tr>");
print("<tr>\n<td bgcolor=\"white\" colspan=\"2\">\n<strong>\n");
printf("<font color=\"blue\">%s %s</font>\n</strong>\n</td>\n</tr>\n",
$row["heading"], $row["bulletin_number"]);
print("<tr>\n<td valign=\"top\">\n<h2 class=\"c1\">\n<br />Dealer
Bulletin</h2>");
printf("<strong>Date:</strong> %s\n",
$row["bulletin_date"]);
printf("<br />\n<strong>Number:</strong> %s\n",
$row["bulletin_number"]);
printf("<br />\n<strong>Subject:</strong> %s\n",
$row["bulletin_subject"]);
printf("<br />\n<strong>From:</strong> %s<br />%s\n",
$row["bulletin_from1"], $row["bulletin_from2"]);
print("</td>\n<td valign=\"top\" align=\"left\">\n");
print("<font face=\"Arial Black\" size=\"+6\">SIMRAD</font>\n");
print("<br />\n<font size=\"3\"> A
<strong>KONGSBERG</strong> Company</font>\n</center>\n");
print("<br />Simrad Inc.\n");
print("<br />19210-33<sup>rd</sup> Avenue West, Suite A\n");
print("<br />Lynnwood, WA 98036\n");
print("<br />U.S.A.\n");
print("<br />Telephone: 1-425-778-8821\n");
print("<br />Telefax: 1-425-771-7211\n");
print("<br />\n<br />\n</td>\n</tr>");
printf("<tr>\n<td colspan=2>%s\n",
$row["body"]);
print("<br />\n<hr width=\"75%\" />\n");
}
else:
printf("<tr><td>* %s <br /> %s<br
/> %s</td></tr>",
$row["bulletin_subject"],$row["bulletin_from1"],$row["bulletin_date"]);
endif;
?>
<tr>
<td></td>
</tr>
</table>
</body>
</html>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php