| Author |
Message |
AYK Hangin' Around

Joined: Apr 03, 2004 Posts: 32
|
Posted:
Sat Apr 03, 2004 5:26 am |
|
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 ? |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sat Apr 03, 2004 9:17 am |
|
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"> |
|
|
|
|
 |
AYK Hangin' Around

Joined: Apr 03, 2004 Posts: 32
|
Posted:
Mon Apr 05, 2004 4:48 am |
|
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 Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Mon Apr 05, 2004 5:06 am |
|
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 Hangin' Around

Joined: Apr 03, 2004 Posts: 32
|
Posted:
Mon Apr 05, 2004 5:13 am |
|
This is the url that appears :
hmm... I do not see it calling the ce.php file anywhere ... |
|
|
|
 |
AYK Hangin' Around

Joined: Apr 03, 2004 Posts: 32
|
Posted:
Mon Apr 05, 2004 5:14 am |
|
And it's not a unix system by the way : it's apache on winxp.
Thanks for the fast response by the way ! |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Mon Apr 05, 2004 6:26 am |
|
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 Hangin' Around

Joined: Apr 03, 2004 Posts: 32
|
Posted:
Tue Apr 06, 2004 5:41 pm |
|
Thanks ! I got it to work now.  |
|
|
|
 |
|
|
|
|