Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
AYK
Hangin' Around



Joined: Apr 03, 2004
Posts: 32

PostPosted: Sat Apr 03, 2004 5:26 am Reply with quote

Hello,

I'm self-learning PHP and MYSQL at the moment from a book, and they were giving some examples like making a guestbook ( really really basic one ).

Now I'm having this problem :
I created module and an index.php for the guestbook allready were you are supposed to leave your message for the guestbook. Now when people press the submit button, I want the next PHP file to appear in the same place as the sign-in page. How can I do that ?
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Apr 03, 2004 9:17 am Reply with quote

I will assume you are calling the next file through a <form> tag using the ACTION attribute. To make the next file display in the same nuke window, you must code the ACTION attribute like this
Code:
<form action="modules.php?name=MODULE_NAME&file=FILE_NAME_WITHOUT_EXTENSION">
 
View user's profile Send private message
AYK







PostPosted: Mon Apr 05, 2004 4:48 am Reply with quote

Thanks for the reply Raven ! I've been trying to fix the problem now but I'm getting the message "sorry such file doesn't exist".

This is the INDEX.PHP of the module :

Code:
<?php

#### Generated by Module Creator - By Disipal site (www.disipal.net) ####
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");

}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

include("header.php");
$index = 1;
OpenTable();
echo " ";
echo "Sign my Guestbook !!!";
echo "<form action=modules.php?name=AYK&file=ce>";
echo "<table>";
echo "<TR>";
echo "<TD>";
  echo "<b>Name :</b>";
echo "</TD><TD>";
  echo "<input type=text size=40 name=name>";
  echo "</TD";
  echo "</TR></table>";
  echo "<br>";
  echo "<b>Location :</b>";
  echo "<input type=text size=40 name=location>";
  echo "<br>";
  echo "<b>E-mail :</b>";
  echo "<input type=text size=40 name=email>";
  echo "<br>";
  echo "<b>Home page :</b>";
  echo "<input type=text size=40 name=url>";
  echo "<br>";
  echo "<b>Comments :</b>";
  echo "<textarea name=comments cols=40 rows=4 wrap=virtual></textarea>";
  echo "<br>";
  echo " ";
  echo "<input type=submit name=submit value=Sign!>";
  echo "<input type=reset name=reset value=Start over>";
  echo " ";
  echo "</form>";

CloseTable();
include("footer.php");

?>


And this is the file ( CE.PHP ) that I want to appear when one presses the sign ! button :

Code:
<?php

#### Generated by Module Creator - By Disipal site (www.disipal.net) ####
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");

}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

include("header.php");
$index = 1;
OpenTable();

include(dbconnect.php);

if ($submit == Sign !)
{
    $query = insert into guestbook
             (name,location,email,url,comments) values
             ('$name','$location','$email', '$url', '$comments')
             ;
             mysql_query($query) or
                 die ( mysql_error());
   
echo "<h2>Thanks !!!</h2>";
echo "<h2><a href=view.php>View My guestbook !!!</a></h2>";

 
}

else

{
    include(sign);
}



CloseTable();
include("footer.php");

?>


All files are in the /modules/ayk ( name of the module ) directory.

Do you have any tips for me ?
 
Raven







PostPosted: Mon Apr 05, 2004 5:06 am Reply with quote

When you click on the submit button and you get the error message, is the url in your browser the correct url? Remember on *nix systems it is case sensitive.
 
AYK







PostPosted: Mon Apr 05, 2004 5:13 am Reply with quote

This is the url that appears :

http://www.ayk.nl/modules.php?name=&location=&email=&url=&comments=&submit=Sign%21

hmm... I do not see it calling the ce.php file anywhere ...
 
AYK







PostPosted: Mon Apr 05, 2004 5:14 am Reply with quote

And it's not a unix system by the way : it's apache on winxp.

Thanks for the fast response by the way !
 
Raven







PostPosted: Mon Apr 05, 2004 6:26 am Reply with quote

I made a [mis]assumption that you would add the METHOD attribute to your FORM tag. Modify it to read
Code:
<form method=post action=modules.php?name=AYK&file=ce>
 
AYK







PostPosted: Tue Apr 06, 2004 5:41 pm Reply with quote

Thanks ! I got it to work now. Laughing
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©