hi! im olive, i only new the basics of php and i have this problem..our website has it's own feedback form but for some reasons it's not working, can someone help me find what could be the problem in the script coz everytime i hit the submit form in the feedback form page it always return the error 'Invalid Entry: Hit your browsers back button and resubmit the form.' and the message posted is not saved at all..here are the scripts used in our feedback form and the html form. please someone who could help me..thank you.
loginf.php
<?php
//Change these to match your site.
$bgcolor = '#FFFFFF';
$title = 'PVAO Feedback';
$font = 'Arial';
$fontcolor = '#666633';
$tfont = '"#666633';
$guestinfo_tablecolor = '#CCFFCC';
$messagebody_tablecolor = '#CCFFCC';
$guestinfo_fontcolor = '#666633';
$messagebody_fontcolor = '#666633';
$data = 'guestbook.dat';
$posted_on = Date("M d, Y");
$ok_to_post = 1;
$error_string = 'Invalid Entry: Hit your browsers back button and resubmit the form.';
?>
-----
log.php
<?php
require ("loginf.php");
echo "<html>";
echo "<head>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"pvao.css\">";
echo "<title>$title</title>";
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"5; URL=feedbac.html\">";
echo "</head>";
echo "<body bgcolor=\"$bgcolor\">";
if(!$guest){
echo "$error_string";
$ok_to_post = 0;
exit;
}
echo "<h4>Thank you for your feedback<br>You will be redirected to the Feedback Page in a moment.<br><br><a href=\"http://server.pvao.mil.ph/feedbac.html\">Click here</a> if you don't want to wait.</h4>";
$entered = FALSE;
if (file_exists($data))
{
$guestentry = "$guest|$email|$url|$message|$R1|$R2|$posted_on\n" ;
$file = fopen($data,"a");
if(flock($file,2))
fputs($file,$guestentry);
else
exit("Error: couldn't open file");
if(flock($file,3))
fclose($file);
else
exit("Error: couldn't open file");
$entered = TRUE;
}
?>
------
logview.php
<?php
require ("loginf.php");
$home_url='http://server.pvao.mil.ph';
echo "<html>";
echo "<head>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"pvao.css\">";
echo "<title>$title</title>";
echo "<body bgcolor=\"$bgcolor\">";
echo "<center><h3>$title View </h3></center>";
echo "<a href=\"index.html\">Back to PVAO Main</a><br> <br>";
if (file_exists($data))
{
$afile = file($data);
for($num = 0; $num < count($afile); $num++)
{
$bfile = explode("|",$afile[$num]);
echo "<br><div align=\"center\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"85%\">";
echo "<td width=\"10%\" bgcolor=\"$guestinfo_tablecolor\" align=\"right\" valign=\"top\">";
echo "<p align=\"right\">Last Signed: <br>";
echo "By<br>";
echo "E-Mail:<br>Address:<br>R1:<br>R2:</td>";
echo "<td width=\"50%\" bgcolor=\"$guestinfo_tablecolor\" valign=\"top\">";
echo "$bfile[6]<br>$bfile[0]<br>$bfile[1]<br>$bfile[2]<br>$bfile[4]<br>$bfile[5]</td></tr></table></div>";
echo "<div align=\"center\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"85%\">";
echo "<tr>";
echo "<td width=\"10%\" bgcolor=\"$messagebody_tablecolor\" valign=\"top\" align=\"right\">Message:</td>";
echo "<td width=\"65%\" valign=\"top\" bgcolor=\"$messagebody_tablecolor\">$bfile[3]</td></tr></table></div>";
echo "<hr>";
}
}
else
{
echo "<tr><td>Couldn't open $data</td></tr>";
}
?>
<BR>
<BR>
<BR>
</body>
</html>
---
1 1215
hi! im olive, i only new the basics of php and i have this problem..our website has it's own feedback form but for some reasons it's not working, can someone help me find what could be the problem in the script coz everytime i hit the submit form in the feedback form page it always return the error 'Invalid Entry: Hit your browsers back button and resubmit the form.' and the message posted is not saved at all..here are the scripts used in our feedback form and the html form. please someone who could help me..thank you.
loginf.php
<?php
//Change these to match your site.
$bgcolor = '#FFFFFF';
$title = 'PVAO Feedback';
$font = 'Arial';
$fontcolor = '#666633';
$tfont = '"#666633';
$guestinfo_tablecolor = '#CCFFCC';
$messagebody_tablecolor = '#CCFFCC';
$guestinfo_fontcolor = '#666633';
$messagebody_fontcolor = '#666633';
$data = 'guestbook.dat';
$posted_on = Date("M d, Y");
$ok_to_post = 1;
$error_string = 'Invalid Entry: Hit your browsers back button and resubmit the form.';
?>
-----
log.php
<?php
require ("loginf.php");
echo "<html>";
echo "<head>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"pvao.css\">";
echo "<title>$title</title>";
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"5; URL=feedbac.html\">";
echo "</head>";
echo "<body bgcolor=\"$bgcolor\">";
if(!$guest){
echo "$error_string";
$ok_to_post = 0;
exit;
}
echo "<h4>Thank you for your feedback<br>You will be redirected to the Feedback Page in a moment.<br><br><a href=\"http://server.pvao.mil.ph/feedbac.html\">Click here</a> if you don't want to wait.</h4>";
$entered = FALSE;
if (file_exists($data))
{
$guestentry = "$guest|$email|$url|$message|$R1|$R2|$posted_on\n" ;
$file = fopen($data,"a");
if(flock($file,2))
fputs($file,$guestentry);
else
exit("Error: couldn't open file");
if(flock($file,3))
fclose($file);
else
exit("Error: couldn't open file");
$entered = TRUE;
}
?>
------
logview.php
<?php
require ("loginf.php");
$home_url='http://server.pvao.mil.ph';
echo "<html>";
echo "<head>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"pvao.css\">";
echo "<title>$title</title>";
echo "<body bgcolor=\"$bgcolor\">";
echo "<center><h3>$title View </h3></center>";
echo "<a href=\"index.html\">Back to PVAO Main</a><br> <br>";
if (file_exists($data))
{
$afile = file($data);
for($num = 0; $num < count($afile); $num++)
{
$bfile = explode("|",$afile[$num]);
echo "<br><div align=\"center\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"85%\">";
echo "<td width=\"10%\" bgcolor=\"$guestinfo_tablecolor\" align=\"right\" valign=\"top\">";
echo "<p align=\"right\">Last Signed: <br>";
echo "By<br>";
echo "E-Mail:<br>Address:<br>R1:<br>R2:</td>";
echo "<td width=\"50%\" bgcolor=\"$guestinfo_tablecolor\" valign=\"top\">";
echo "$bfile[6]<br>$bfile[0]<br>$bfile[1]<br>$bfile[2]<br>$bfile[4]<br>$bfile[5]</td></tr></table></div>";
echo "<div align=\"center\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"85%\">";
echo "<tr>";
echo "<td width=\"10%\" bgcolor=\"$messagebody_tablecolor\" valign=\"top\" align=\"right\">Message:</td>";
echo "<td width=\"65%\" valign=\"top\" bgcolor=\"$messagebody_tablecolor\">$bfile[3]</td></tr></table></div>";
echo "<hr>";
}
}
else
{
echo "<tr><td>Couldn't open $data</td></tr>";
}
?>
<BR>
<BR>
<BR>
</body>
</html>
---
Hi,
Haven't checked your code throughly but it seems that here where it is throwing the error....
[PHP]
if(!$guest){
echo "$error_string";
$ok_to_post = 0;
exit;
}
[/PHP]
So check for the '$guest' value in your code. Or from wherever it is coming.
Regards,
RP
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chuck Grimsby |
last post by:
(Repost, due to lack of submissions...)
The Microsoft Access Product Group (the people who build Microsoft
Access) want your help!
One of the main things we're working on for the near future...
|
by: bangaw |
last post by:
i'm currently using c++ on windowsXP,
unistd.h doesnt work for windows
what other substitute for it could i use to replace it
Pls. Help me Pls pls
the code goes as follows
#include <stdio.h>...
|
by: naheed javaid |
last post by:
I m student and doing my final project. My project is related to screen capturing.
my project captures screen and save the captured screen as bitmaps in a folder.
while the screen recording audio...
|
by: SanjaiGandhi |
last post by:
Hi ...i am new to programing....pls help to overcome this program..
The Program is..:
if a = 557..using for loop or while or dowhile ..we have to get the
answer for 5+5+7..that is what ever...
|
by: Riaaaa |
last post by:
Pls check my code for the stored procedure which i created for the companydetails including
companyid P.K. Not Null int(4),
companyname Not Null varchar (20),
address varchar(30)
where...
|
by: Anatha Man |
last post by:
Hello All Expert and God of King Programmer !
Pls help me now .
i create a dictionary project by use Database Snapshot is Back End and VB2005 is front end but i don't know how to connect to...
|
by: vbsoft |
last post by:
Hello My Name is Mike
Am from Nigeria a student of computer Science,
Pls i want your You to help in
Using VISUAL BASIC 6.0 AND MS SQL SERVER AS DATABASE AS A CLIENT SERVER SIDE
pLS: I...
|
by: sonuindia88 |
last post by:
Some common confusions
.I am reading Ritchie and Deitel and practising questions from Yashwant Kanetkar...Here are some of the confusions i am having..your help is required....
Q1)
...
|
by: ananthaisin |
last post by:
Hi,
This is the query i am trying to build
I have attached the same in the file....
while running its throwing an error ........
NVL((SELECT USAGEMODE FROM KKTYPEMAST_AP B WHERE...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |