Assign input field value from previous page to a session and access with PHP
<p><strong>My Question</strong></p>

<p>I have a contact form and it has a input field called </p>

<pre><code>&lt;input type="text" name="subject" id="subject" value="Car"&gt;
</code></pre>

<p>and the second form with a input field called</p>

<pre><code>&lt;input type="text" name="subject" id="subject" value="Home"&gt;
</code></pre>

<p>When someone clicks submit, the user is directed to a generic thank you page with a div in it as follows</p>

<pre><code>&lt;div class="lead_form_thankyou"&gt;Thank you message&lt;/div&gt;
</code></pre>

<p>What I am trying to do is, assign the input field value to a session and access it while on the thank you page to display a customised Thank you message. </p>

<p><strong>My Code</strong></p>

<p>I have this code now </p>

<pre><code>$subjectForThankYouMsg = $("#subject").val();

if($subjectForThankYouMsg == "Home"){
    $(".lead_form_thankyou").text("Thank you for choosing our Car.");

}

else if($subjectForThankYouMsg == "Car"){
    $(".lead_form_thankyou").text("Thank you for choosing our Home.'+\n+' We will be in touch with you shortly.");

}
</code></pre>

<p><strong>My Issue</strong></p>

<p>Im finding it hard to mix jQuery and PHP and assign <code>$subjectForThankYouMsg</code> value to a session. Can someone please guide me? Let me know if this is not clear. Thanks</p>
