I have link with e-mail like:
<a href="mailto:no-reply@mydomain.com">My e-mail address</a>

When clicked on link it should do two tasks:
1. PHP SESSION variable:
$_SESSION["var"] = "no-reply@mydomain.com";
2. Live Ajax value to publish at form

As there is stored value into session $_SESSION["var"] = "no-reply@mydomain.com";
there should be Ajax based SESSION value to transfer further to form.

How to retrieve this e-mail address into the same page (Live change) and store into SESSION variable.

Regards and thank you for your reply.

Recommended Answers

All 5 Replies

href="mailto:no-reply@mydomain.com" specify to use the mailto protocol with the no-replay@mydomain.com as a parameter.

To do what you want you need to create a javascript function that will make an ajax request to change the session variable and return the content you want.

Hope it helps.

href="mailto:no-reply@mydomain.com" specify to use the mailto protocol with the no-replay@mydomain.com as a parameter.

To do what you want you need to create a javascript function that will make an ajax request to change the session variable and return the content you want.

Hope it helps.

How to do it with Jquery/Ajax method? Is there an example?

There's lots of examples at http://docs.jquery.com.
But it's quite simple, something like this:

function doMyThing(strEmail)
{
	$.post( // JQuery post method
		"MyPage.php",  // First parameter is the url
		{ email: strEmail },  // Second is the request data
		function(result) // Third is the function to handle the response
		{
			alert("AJAX Response: " + result);
		}
	);
}

Thank you. How to store into session? strEmail is LIVE variable (not server)
$_SESSION["var"] = $strEmail;

Is this possible?

I don't know much of PHP, so I don't know what a LIVE variable is.

But as far as I know, with session, you can do it like this:

$strEmail = $_REQUEST["email"];
$_SESSION["var"] = $strEmail;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.