получить значение из сеанса в java script на php
Привет,
Друзья у меня есть код
<?php <br mode="hold" /?>session_start(); if( isset($_POST['Submit'])) { if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. //echo 'Thank you. Your message said "'.$_POST['message'].'"'; echo "<script>alert('Thank you. Your message said.....')</script>"; echo "<script type='text/javascript'> alert('".json_encode($_SESSION['security_code'])."'); </script>"; unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here echo 'Sorry, you have provided an invalid security code'; echo "<script>alert('Sorry, you have provided an invalid security code')</script>"; } } else { ?> <tr> <td height="50" valign="top"> </td> <td valign="top"><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /></td> </tr> <tr> <td height="30" valign="top">Security Code:<span class="required" style="color:#93B928;">*</span></td> <td valign="top"><input id="security_code" name="security_code" type="text" style="width:100px;"/></td> </tr> <tr> <td height="50" valign="top"> </td> <td valign="top"><input class="button" name="Submit" value="Send" type="submit" /></td> </tr> } ?>
мне нужно это значение сеанса в моем коде java script
function form_validation() { hh=document.WebToLeadForm; if(!hh.security_code.value==""){ var a = <?php echo $_SESSION['security_code']; ??> alert("Please wait to check for match"); return false; }
я использую код, но не работает может u pls выяснить, как его использовать..
заранее спасибо
Раджеш