PhpDig.net

Go Back   PhpDig.net > General Forums > Coding & Tutorials

Reply
 
Thread Tools
Old 01-18-2006, 12:42 PM   #1
NPeart1
Green Mole
 
Join Date: Dec 2005
Posts: 2
PHP form processing problem - Please advise

I have a php form that only partially works:

1.) The php script displays user comments in HTML. The comments are submitted into an SQL database through a php web form. When comments are first written to the database, they are given an "N", which means that the comment hasn't been physically responded to by a member of the development team.

2.) When you first load the page, reply.php, it lists all open comments. After a particular comment has been physically responded to by a member of the development team, the developer will click the Close button next to a particular comment. Clicking close should update the record in the database with a "Y" while refreshing the page with the remaining (or open) comments (the comment that was just closed should not display again, but does).

Does anyone have any advise regarding the code below?

Thanks in advance for any help!

<?

if(!empty($reply)) {

$connection_string = 'DRIVER={SQL Server};SERVER=ebsqlc1.com\ebs_sql;DATABASE=PPAD';

$user = 'PPadUser';
$pass = 'rmot22';

$connection = odbc_connect( $connection_string, $user, $pass );

$query = "UPDATE contactd SET reply = 'Y' WHERE seqNum = '$reply'";

$result = odbc_exec($connection,$query)
or die("Query Failed: ".odbc_error()." - ".$query);

}

$connection_string = 'DRIVER={SQL Server};SERVER=ebsqlc1.com\ebs_sql;DATABASE=PPAD';

$user = 'PPadUser';
$pass = 'rmot22';

$connection = odbc_connect( $connection_string, $user, $pass );

$query = "Select * from contactd where reply = 'N'";

$result = odbc_exec($connection,$query)
or die("Query Failed: ".odbc_error()." - ".$query);

$trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);

while ($row = odbc_fetch_array($result)) {
$name = str_replace('+',' ',urlencode(stripslashes($row['name'])));
$subject = str_replace('+',' ',urlencode(stripslashes($row['subject'])));
$body = str_replace('+',' ',urlencode(stripslashes($row['comments'])));

$date = substr($row['date'],0,10);

echo "<form name=$row[seqNum] method=POST action=reply.php>";
echo "<tr>\n";
echo "<td><font face=Tahoma,Arial,Helvetica size=1>$date</font></td>\n";
echo "<td><font face=Tahoma,Arial,Helvetica size=1>$row[name]</font></td>\n";
echo "<td><font face=Tahoma,Arial,Helvetica size=1>$row[empNum]</font></td>\n";
echo "<td><font face=Tahoma,Arial,Helvetica size=1><a href=\"mailto:$row[email]?subject=RE: $subject&body=$name:%0D%0A%0D%0A%0D%0A On $date You Wrote: %0D%0A%0D%0A$body\">$row[email]</a></font></td>\n";
echo "<td><font face=Tahoma,Arial,Helvetica size=1>$row[deptSta]</font></td>\n";
echo "<td><font face=Tahoma,Arial,Helvetica size=1>$row[mailList]</font></td>\n";
echo "<td><input type=hidden name=reply value=$row[seqNum]><font face=Tahoma,Arial,Helvetica size=1><input type=submit name=close value=Close></font></td>\n";
echo "</tr>\n";
echo "<tr><td colspan=7><font face=Tahoma,Arial,Helvetica size=1><b>Subject:</b> $row[subject]</font></td></tr>\n";
echo "<tr><td colspan=7><font face=Tahoma,Arial,Helvetica size=1><b>Comments:</b> $row[comments]</font></td></tr>\n";
echo "</form>";

}

?>
NPeart1 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
basic php/mysql verification problem sturomanek Coding & Tutorials 1 03-21-2007 08:06 PM
problem with config.php with line 109 CDD Troubleshooting 0 11-21-2006 09:15 AM
spider.php problem digdug Script Installation 8 10-18-2006 08:25 AM
.php/x/x problem nosrak Troubleshooting 1 01-14-2005 08:29 PM
problems with command processing bthurlow Troubleshooting 3 10-03-2003 09:27 PM


All times are GMT -8. The time now is 07:45 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.