Page 1 of 1
Fields on replies from not the same as new posts?
Posted: Mon Apr 02, 2012 10:53 am
by garybrett37
Script URL: local during testing
Version of script:
Hosting company: na
URL of phpinfo.php: localhost
URL of session_test.php:
What terms did you try when SEARCHING for a solution: 'session', 'name fields', 'reply post fields'
Write your message below:
Hi there wonder if you could help me with a small issue? On the mboard.php page I removed the email address field as its not relevant to my install, this works fine on the 'add new topic' page but the field reappears on the replies to post page, I cannot work out where its getting this field from? When I view the files in the msg folder they all revert back to the original page layout and not the edited mboard.php, it even applies the old css file back to replies page despite me changing in original?
Also is it possible to have the name field not vaildated? I added a session value to the input field with logged in users name but the form always asks for a name on submit?
Kind regards
Re: Fields on replies from not the same as new posts?
Posted: Mon Apr 02, 2012 3:01 pm
by Klemen
The HTML code for creating new files is in the createNewFile function, so you will need to edit it twice in the mboard.php file. Note that any changes you make will only reflect on new posts, not existing (old) ones.
To ignore validating name try changing
Code: Select all
$name=pj_input($_POST['name'],'Please enter your name!');
to just
or whatever variable you want to use. If you remove the error message from the pj_input() calls the function will not return any errors.
Re: Fields on replies from not the same as new posts?
Posted: Mon Apr 02, 2012 3:54 pm
by garybrett37
Hi there Klemen, many thanks for the prompt reply, made the changes which appears to have worked ok. On the reply to post page though it wont allow me to insert the session variable, in the new post code section its fine, I get the error below;
Parse error: syntax error, unexpected T_STRING in C:\www\mboard\mboard.php on line 386
Line 386 is '<input type="hidden" name="a" value="reply"><b>Name:</b><br><input type=text name="name" value="$_SESSION['Security_ContactName']" size=30 maxlength=30>'
If I change this to '<input type="hidden" name="a" value="reply"><b>Name:</b><br><input type=text name="name" value="mywebuser" size=30 maxlength=30>' it works fine again but I really would like it to insert the session value as its does on the new post form..?
Thanks again much appreciated..
Re: Fields on replies from not the same as new posts?
Posted: Mon Apr 02, 2012 5:32 pm
by Klemen
Try removing quotes around Security_ContactName
Re: Fields on replies from not the same as new posts?
Posted: Tue Apr 03, 2012 7:35 am
by garybrett37
Hi again, thanks for helping, that stops the page error but leaves the name field as '$_SESSION[Security_ContactName]'. I have also tried other session values to test but it always returns the same error as before even though I have exactly the same values in the new post form at top of page?
Very odd, its stopping me progressing unfortunately..
Kind regards
Gary
Re: Fields on replies from not the same as new posts?
Posted: Tue Apr 03, 2012 3:35 pm
by Klemen
You are probably mixing variable names with incorrect quotes.
PHP differences between double ( " ) and single ( ' ) quote. Example:
Code: Select all
$variable = 'Test';
echo "This is a $variable";
// Variable inside double quotes result in: This is a Test
echo 'This is a $variable';
// Variable inside single quotes result in: This is a $variable
So when using single quotes PHP treats $variable as text, not as a variable.
Here are a few more examples:
http://www.trans4mind.com/personal_deve ... quotes.htm
If you are aware of all this then the problem is probably you are using wrong variable names. I'm afraid I can't help with that as I don't know how you register (set) your $_SESSION variables nor is this the purpose of this forum.
Tip: you can see all variables you have inside $_SESSION by printing them out using something like