Unique php page

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
Well then you can check that the $memid variable is set before the page content is displayed, and then redirect if not set.
 

bunglebrown

New Member
Messages
157
Reaction score
0
Points
0
Following on from my previous post - is it possible to send the $SESSION variable to email because when I put $_SESSION['memid'] into the email message it returns an error.
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
Following on from my previous post - is it possible to send the $SESSION variable to email because when I put $_SESSION['memid'] into the email message it returns an error.

Again, I refer to my post on page 1.

It might be worthwhile to let us know what the error is.
 

bunglebrown

New Member
Messages
157
Reaction score
0
Points
0
We might be crossing wires here - the page that sends the mail link to the user is working great but I was considering getting the memid mailed to me on the link page with other information (which is coming through fine).

The error is:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/myusername/public_html/mysite/4.php on line 2939

Line 2939 is:

PHP:
$message = "'$_SESSION['memid']'";

I tried it as a few things but with no success. Any ideas?

_Thanks
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
We might be crossing wires here - the page that sends the mail link to the user is working great but I was considering getting the memid mailed to me on the link page with other information (which is coming through fine).

The error is:



Line 2939 is:

PHP:
$message = "'$_SESSION['memid']'";

I tried it as a few things but with no success. Any ideas?

_Thanks

You need to inspect the code more carefully on page 1 of this post.

In order for a variable to be printed within the message, you need to break the code up with stops.

i.e.

PHP:
$message= '
some normal html text without any single quotes but can include double quotes'.$variable.' more normal text';

alternatively, you can use double quotes but in the following format.

PHP:
$message= "
some normal html text without any double quotes but can include single quotes".$variable." more normal text";

As you can see, the double quote stops the content before the variable. The stop adds something after to the previous content. The stop after the variable adds more content. The the opening double quotes continues the normal content.

In this way, you can mix multiple variables and standard html. Just be careful of the type of quotes.

PHP:
$message = "variable 1:".$_SESSION['memid']."<br>variable 2:".$anothervariable."<br><table><tr><td>&nbsp;</td></tr></table>";
 

bunglebrown

New Member
Messages
157
Reaction score
0
Points
0
In this way, you can mix multiple variables and standard html. Just be careful of the type of quotes.

PHP:
$message = "variable 1:".$_SESSION['memid']."<br>variable 2:".$anothervariable."<br><table><tr><td>&nbsp;</td></tr></table>";

I used it in this example and followed your instructions rigidly on page 1 and this error came back which I'm not sure how to deal with:

An SQL error occurred. Do some debugging
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

Are you familiar with this and how do you suggest I overcome it?

_Thanks
 

cursedpsp

New Member
Messages
237
Reaction score
0
Points
0
yeah I think that what he wants I dont get why you cant just make that in html though... why does it half to be php?

Its impossible to do it in HTML, anything that requires fuctions HTML cannot support - however though, by linking to an external or internal javascript you can "reference" to a javascript function.
Like

"<a href='javascript: function(countPages);'>Count Pages</a>"

Like so - but i am no good at JavaScript, only PHP
 
Top