Page 1 of 1

Couple of simple questions

Posted: Sun Aug 20, 2006 11:58 pm
by AdRock
First, how many guestbook entries are there before it puts them on to other pages (I need to fit it within a set page size)

Is there a way I can have the persons name and email address filled in automatically from a session that would have started previously? The user would have been logged in and it seems pointless and frustrating to have to enter that information when it is already stored ina database

Posted: Mon Aug 21, 2006 6:01 am
by Henrie
Hello AdRock,

The standard number of entries on one page is 10. There is a modification posted in the forums that let you change the number of posts on one page.

For your other question. I do not know enough php yet to answer this question. Perhaps Klemen can tell you.

Greetings,
Henrie

Re: Couple of simple questions

Posted: Mon Aug 21, 2006 8:58 am
by Klemen
AdRock wrote:Is there a way I can have the persons name and email address filled in automatically from a session that would have started previously? The user would have been logged in and it seems pointless and frustrating to have to enter that information when it is already stored ina database
Well if you have the name/email/etc... stored in a session you could edit the GBook form and add the values from session to the form, try changing and playing around with

Code: Select all

function printSign($name='',$from='',$email='',$url='',$comments='',$nosmileys='',$isprivate='',$error='') {
You can try for example

Code: Select all

function printSign($name=$_SESSION['name'], $from='', $email=$_SESSION['email'],$url='' , $comments='',$nosmileys='', $isprivate='', $error='') {

Posted: Mon Aug 21, 2006 1:15 pm
by AdRock
I tried what you said about changing that line but I get this error message now

Parse error: syntax error, unexpected T_VARIABLE in /home/adrock/public_html/gbook/gbook.php on line 686

Posted: Mon Aug 21, 2006 1:43 pm
by Klemen
Can you post that line (and few lines around it) here?

Posted: Mon Aug 21, 2006 10:38 pm
by AdRock

Code: Select all

function printSign($name=$_SESSION['name'], $from='', $email=$_SESSION['email'],$url='' , $comments='',$nosmileys='', $isprivate='', $error='') {
global $settings;
$url=$url ? $url : 'http://';
?>
<h3 align="center">Sign guestbook</h3>
<p>Required fields are <b>bold</b>.</p>
<form action="gbook.php" method="POST" name="form">
<input type="hidden" name="a" value="add">
<table class="entries" cellspacing="0" cellpadding="4" border="0">
<tr>
<td>

Posted: Tue Aug 22, 2006 9:14 am
by Klemen
Ah, that won't work, forgot you can't assign variable sot variables in function call.

You will have to edit the form itself, for example change the

Code: Select all

value="<?php echo $name; ?>"
to

Code: Select all

value="<?php echo $name ? $name : $_SESSION['name']; ?>
DON'T just use $_SESSION['name'] , use whatever variable your sessions use to store the name.

You do know what variables your session uses, don't you?
If YES: then you shouldn't have problems setting it up from here on :wink:
if NO: sorry, can't help you then, I'm not hear to study other's scripts and teach anyone PHP/HTML

Posted: Tue Aug 22, 2006 11:10 am
by AdRock
Yes I do....thanks a lot. That should do what exactly i want now