Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Error in custom pages

Asked Modified Viewed 2,515 times
M
mario2710
M
php-fusion 6.01.9
  • Newbie, joined since
  • Contributed 6 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
asked
Newbie

I want to make a form in "Custom Pages". Found a little php script here from Korcsii but it gave me an error. Copied the code of contact.php into a custum page and when submitting the form the same error occurs:

Internal error

Unable to retrieve page content.


Am I doing something wrong here???
0 replies

8 posts

W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

If you posted the code you are atempting to use in custom page it would be easier to help you.

This will work in a custom page based on code from the contact.php:

<?php
include LOCALE.LOCALESET."contact.php";

if (isset($_POST['sendmessage'])) {
   $error = "";
   $mailname = substr(stripinput(trim($_POST['mailname'])),0,50);
   $email = substr(stripinput(trim($_POST['email'])),0,100);
   $subject = substr(str_replace(array("\r","\n","@"), "", descript(stripslash(trim($_POST['subject'])))),0,50);
   $message = descript(stripslash(trim($_POST['message'])));
   if ($mailname == "") {
      $error .= "· <span class='alt'>".$locale['420']."</span><br>\n";
   }
   if ($email == "" || !preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
      $error .= "· <span class='alt'>".$locale['421']."</span><br>\n";
   }
   if ($subject == "") {
      $error .= "· <span class='alt'>".$locale['422']."</span><br>\n";
   }
   if ($message == "") {
      $error .= "· <span class='alt'>".$locale['423']."</span><br>\n";
   }
   if (!$error) {
      require_once INCLUDES."sendmail_include.php";
      sendemail($settings['siteusername'],$settings['siteemail'],$mailname,$email,$subject,$message);
      opentable($locale['400']);
      echo "<center><br>\n".$locale['440']."<br><br>\n".$locale['441']."</center><br>\n";
      closetable();
   } else {
      opentable($locale['400']);
      echo "<center><br>\n".$locale['442']."<br><br>\n$error<br>\n".$locale['443']."</center><br>\n";
      closetable();
   }
} else {
   opentable($locale['400']);
   echo $locale['401']."<br><br>
<form name='userform' method='post' action='".FUSION_SELF."'>
<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='100'>".$locale['402']."</td>
<td><input type='text' name='mailname' maxlength='50' class='textbox' style='width: 200px;'></td>
</tr>
<tr>
<td width='100'>".$locale['403']."</td>
<td><input type='text' name='email' maxlength='100' class='textbox' style='width: 200px;'></td>
</tr>
<tr>
<td width='100'>".$locale['404']."</td>
<td><input type='text' name='subject' maxlength='50' class='textbox' style='width: 200px;'></td>
</tr>
<tr><td valign='top' width='90'>".$locale['405']."</td>
<td><textarea name='message' rows='10' class='textbox' style='width: 320px'></textarea></td>
</tr>
<tr>
<td align='center' colspan='2'>
<input type='submit' name='sendmessage' value='".$locale['406']."' class='button'>
</td>
</tr>
</table>
</form>\n";
   closetable();
}

?>
0 replies
M
mario2710
M
php-fusion 6.01.9
  • Newbie, joined since
  • Contributed 6 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

yes, you're right, sorry. I tried your code and get the same error. However I think I know what is causing the error: after pushing the submit button the link in the browsers adress bar says: www.domainname/viewpage.php. There's no pagenr defined like www.domainname/viewpage.php?page_id=6, so it's refering to a page which can't be found hence the error. In the original contact form a thankyou form will be displayed. So because of this error no e-mail is send either.

So something has to be changed I think, so any help appreciated.
Edited by mario2710 on 05-04-2007 12:00,
0 replies
W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

Sounds like you have a mismatch between database and then the data submitted by the custom page form.

Did you modify any code related to your /administration/custom_pages.php or your database?
0 replies
M
mario2710
M
php-fusion 6.01.9
  • Newbie, joined since
  • Contributed 6 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

I haven't made any changes to the core files, it's just a plain install, checked the database, couldn't find any abnormalities :|
0 replies
G
gmod
G
gmod 10
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

The "Unable to retrieve page content" error means that there is no matching entry in your custom_pages SQL table. Use Mysql to look at the table contents. It should be populated by the custom_pages.php through the admin interface.
0 replies
M
mario2710
M
php-fusion 6.01.9
  • Newbie, joined since
  • Contributed 6 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

that's right, however the tables are filled with pages added through the admin panel, so that's okay. Problem is that after submitting a form on a custum page no page-id will be called to return to as it says: www.domain.com/viewpage.php instead of http://www.domain.com/viewpage.php?page_id=1
0 replies
F
Falk
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
answered
Super Admin

It's not a bug its your code, if no page_id specified you get this error.

Look for this line:
<form name='userform' method='post' action='".FUSION_SELF."'>


Replace with:
<form name='userform' method='post' action='".FUSION_SELF."?page_id=x'>


Replace x with the page_id of your custom page.
0 replies
M
mario2710
M
php-fusion 6.01.9
  • Newbie, joined since
  • Contributed 6 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

that did the trick, thanks Digitanium
0 replies

Category Forum

Bugs and Errors - 6

Labels

None yet

Statistics

  • Views 0 views
  • Posts 8 posts
  • Votes 0 votes
  • Topic users 4 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet