473,889 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help pls!

2 New Member
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_tabl ecolor = '#CCFFCC';
$messagebody_ta blecolor = '#CCFFCC';
$guestinfo_font color = '#666633';
$messagebody_fo ntcolor = '#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=\"styleshee t\" type=\"text/css\" href=\"pvao.css \">";
echo "<title>$ti tle</title>";
echo "<META HTTP-EQUIV=\"refresh \" CONTENT=\"5; URL=feedbac.htm l\">";
echo "</head>";
echo "<body bgcolor=\"$bgco lor\">";
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($d ata))
{
$guestentry = "$guest|$email| $url|$message|$ R1|$R2|$posted_ on\n";
$file = fopen($data,"a" );
if(flock($file, 2))
fputs($file,$gu estentry);
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=\"styleshee t\" type=\"text/css\" href=\"pvao.css \">";
echo "<title>$ti tle</title>";
echo "<body bgcolor=\"$bgco lor\">";
echo "<center><h3>$t itle View </h3></center>";
echo "<a href=\"index.ht ml\">Back to PVAO Main</a><br> <br>";


if (file_exists($d ata))
{
$afile = file($data);
for($num = 0; $num < count($afile); $num++)
{
$bfile = explode("|",$af ile[$num]);
echo "<br><div align=\"center\ ">";
echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"2 \" width=\"85%\">" ;
echo "<td width=\"10%\" bgcolor=\"$gues tinfo_tablecolo r\" align=\"right\" valign=\"top\"> ";
echo "<p align=\"right\" >Last Signed: <br>";
echo "By<br>";
echo "E-Mail:<br>Addres s:<br>R1:<br>R2 :</td>";
echo "<td width=\"50%\" bgcolor=\"$gues tinfo_tablecolo r\" 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=\"$mess agebody_tableco lor\" valign=\"top\" align=\"right\" >Message:</td>";
echo "<td width=\"65%\" valign=\"top\" bgcolor=\"$mess agebody_tableco lor\">$bfile[3]</td></tr></table></div>";
echo "<hr>";
}
}
else
{
echo "<tr><td>Couldn 't open $data</td></tr>";
}
?>
<BR>
<BR>
<BR>
</body>
</html>

---
Jan 8 '08 #1
1 1228
rpnew
188 New Member
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_tabl ecolor = '#CCFFCC';
$messagebody_ta blecolor = '#CCFFCC';
$guestinfo_font color = '#666633';
$messagebody_fo ntcolor = '#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=\"styleshee t\" type=\"text/css\" href=\"pvao.css \">";
echo "<title>$ti tle</title>";
echo "<META HTTP-EQUIV=\"refresh \" CONTENT=\"5; URL=feedbac.htm l\">";
echo "</head>";
echo "<body bgcolor=\"$bgco lor\">";
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($d ata))
{
$guestentry = "$guest|$email| $url|$message|$ R1|$R2|$posted_ on\n";
$file = fopen($data,"a" );
if(flock($file, 2))
fputs($file,$gu estentry);
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=\"styleshee t\" type=\"text/css\" href=\"pvao.css \">";
echo "<title>$ti tle</title>";
echo "<body bgcolor=\"$bgco lor\">";
echo "<center><h3>$t itle View </h3></center>";
echo "<a href=\"index.ht ml\">Back to PVAO Main</a><br> <br>";


if (file_exists($d ata))
{
$afile = file($data);
for($num = 0; $num < count($afile); $num++)
{
$bfile = explode("|",$af ile[$num]);
echo "<br><div align=\"center\ ">";
echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"2 \" width=\"85%\">" ;
echo "<td width=\"10%\" bgcolor=\"$gues tinfo_tablecolo r\" align=\"right\" valign=\"top\"> ";
echo "<p align=\"right\" >Last Signed: <br>";
echo "By<br>";
echo "E-Mail:<br>Addres s:<br>R1:<br>R2 :</td>";
echo "<td width=\"50%\" bgcolor=\"$gues tinfo_tablecolo r\" 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=\"$mess agebody_tableco lor\" valign=\"top\" align=\"right\" >Message:</td>";
echo "<td width=\"65%\" valign=\"top\" bgcolor=\"$mess agebody_tableco lor\">$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
Jan 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

27
3653
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 is a conversion tool to take Microsoft Access 97 databases (primarily, but also Microsoft Access 2000 or 2002/XP databases) up to Microsoft Office Access 2003. For us to do this, we need sample databases from *you*, our customers, to ensure a...
3
5095
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> #include <unistd.h> #include <pthread.h>
0
1554
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 is also captured.i hve saved the captured audio as wav file. i hve created avi form bitmaps only but i m not finding way how to add wav file to avi video. i hve searched alot but not finding help. if any body hve answer of my problem then pls reply...
8
1925
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 numbers we entered to a..that should be added.. for eg if a = 34 the answe should be 7 that is 3+4 using % and / we can solve this problem..pls help me to get the problems
17
4024
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 companyid is the primary key and it should be autogenerate.
1
1415
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 database snapshot. pls tell me and Example how to connect it to VB.NET. pls post your code a full example of how to select data from database snapshot by use VB.NET.. Thankss in advance.. pls reply me soon .. i wait your reply na ..OK ? From a...
1
1474
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 WANT A DEMOSTRATION FORMS THAT WILL EXPLAIN HOW TO DESIGN THE DATABASE. AFTER THAT,
0
1537
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) #include<stdio.h> int main() { printf("%d \n",-5%-4);
1
3140
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 B.TYPE_ID_USG=A.TYPE_ID_USG AND
0
9962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9810
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11198
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10791
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10442
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9609
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6029
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3256
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.