从会话中获取值到php中的java脚本 [英] get value from session into java script in php

查看:67
本文介绍了从会话中获取值到php中的java脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



朋友我有一个代码

 <?php  <   br     mode   =  hold    /? >  session_start(); 

if(isset($ _ POST ['Submit'])){
if($ _SESSION ['security_code'] == $ _POST ['security_code']&&!empty ($ _SESSION ['security_code'])){
//在此输入您处理表单的代码,例如通过电子邮件发送提交,将其输入数据库。
// echo'谢谢。你的消息说''。$ _ POST ['message']。''';
echo< script > alert(' 谢谢。你的消息说.....'< / script > ;
echo< script 类型 =' text / javascript' >
alert(' 。json_encode ($ _SESSION [' security_code ' ])。');
< / script > ;
unset($ _ SESSION ['security_code']);
} else {
//在此处插入您的代码以显示错误消息
echo'抱歉,您提供了无效的安全代码';
echo< script > alert(' 抱歉,您提供了无效的安全码'< / script > ;
}
}其他{
?>
< 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 > 安全代码:< span class = required 样式 = 颜色:#93B928; > * < / span > < / td >
< ; td valign < span class =code-keyword> = top > < 输入 id = security_code 名称 = security_code type = text style = width:100px; / > < / td >
< / tr >
< tr < span class =code-keyword>>
< td height = 50 valign = top > < / td >
< td valign = top > < input class = 按钮 名称 = 提交 value = 发送 < span class =code-attribute> type = 提交 / > < / td >
< / tr >
}
?>





i想在我的java脚本代码中使用此会话值

  function  form_validation()
{
hh = 文档 .WebToLeadForm;
if (!hh.security_code.value == ){
var a =<?php echo $ _SESSION [' security_code']; ??>
alert( 请等待检查匹配);
return false ;
}



i使用代码但无法正常工作可以弄清楚如何使用..



先谢谢



Rajesh

解决方案

_POST ['Submit'])){
if(


_SESSION ['security_code'] ==


_POST ['security_code']&&!empty(

Hi,
Friends i have a code

<?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>
    	}
?>



i want this session value in my java script code

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;
}


i use code but not working can u pls figure it out how to use..

thanks in Advance

Rajesh

解决方案

_POST['Submit'])) { if(


_SESSION['security_code'] ==


_POST['security_code'] && !empty(


这篇关于从会话中获取值到php中的java脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆