将HTML表单字段值传递给使用lightbox lbOn创建的弹出窗口

时间:2013-08-06 02:21:59

标签: php javascript html

我有一份由顾问撰写的申请,而我缺乏知识使得很难做出一个非常简单的改变。我注意到为了显示弹出确认窗口,开发人员使用具有HTML部分的php文件来显示弹出窗口的内容。使用以下语法调用所有弹出窗口 -

<a href="xyz.php" class="button request lbOn">Confirm</a>

他们已经实现了灯箱,将弹出窗口显示为模态。现在我有一个表单,当用户单击save时,我想调用一个弹出窗口进行确认并传递表单字段值。

为简单起见,我提供了一个示例表单 -

<form id="data" action="" method="post">

<li class="profile_label_mem small">Skin Care:
</li>

<li class="profile_detail_mem small">
    <input name="skcare_desc" type="text" class="form_width_mem" id="skcare_desc" {skcare_disab} value="{skcare_desc}" maxlength="30"></input><br />
</li>

当我使用以下行时,虽然我可以将确认窗口显示为模态窗口,但我无法传递表单字段值。

<a href="confirm_housebrand_save.php?skcare=+'<?=$skcare_desc?>'" class="button request lbOn" type="submit" onload="return test()">Update</a>

当我尝试使用以下内容时,虽然我可以获取表单字段值,但我无法打开确认窗口(confirm_housebrand_save.php)作为模式窗口。

<input name="submithousebrand" class="button request" type="submit" onClick="return test()" value="Submit"></input>

</form> 

功能测试的内容

function test() {

alert(document.getElementById('skcare_desc').value,"newwindow");
var newWind=window.open('confirm_housebrand_save.php?skcare=' + document.getElementById('skcare_desc').value);

$j(newWind.document).find('html').addClass('lightbox')

  return false;
}

确认窗口的内容(confirm_housebrand_save.php)

<?
session_start();
if(!$_SESSION['user_id'])
header("location:userlogin.php");

//include('includes/db.php'); 
//include('classes/vendor_class.php');
//include('classes/common_class.php');
//include('classes/campaign_class.php');


if($_SERVER['DOCUMENT_ROOT']!='')
{
    require_once($_SERVER['DOCUMENT_ROOT']."/includes/db.php");
    require_once($_SERVER['DOCUMENT_ROOT']."/classes/vendor_class.php");
    require_once($_SERVER['DOCUMENT_ROOT']."/classes/common_class.php");
    require_once($_SERVER['DOCUMENT_ROOT']."/classes/campaign_class.php");
}
else
{
    $_SERVER['DOCUMENT_ROOT']="/home/vzmhsahv/public_html";

    require_once("includes/db.php");
    require_once("classes/vendor_class.php");
    require_once("classes/common_class.php");
    require_once("classes/campaign_class.php");
}

if($_SESSION['common_data']=='')
{
    $common_data=new common();
    $_SESSION['common_data']=serialize($common_data);
}
else
{
    $common_data=unserialize($_SESSION['common_data']);
}

$skcare_desc    = $_GET['skcare'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" ></meta>
<meta name="keywords" content=""></meta>
<meta name="description" content=""></meta>
<link rel="stylesheet" type="text/css" media="all" href="css/960_16_5_5.css"></link>
<link rel="stylesheet" type="text/css" media="all" href="css/reset.css" ></link>
<link rel="stylesheet" type="text/css" media="all" href="css/form.css" ></link>
<link rel="stylesheet" type="text/css" media="all" href="css/text.css" ></link>
<!--[if lt IE 9]>
    <link rel="stylesheet" type="text/css" href="css/stylemain_ie.css" />
<![endif]-->
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" media="all" href="css/stylemain.css" ></link> <!--<![endif]-->
</head>

<body>
    <div class="pop_box_new pop_width1">
      <div class="close"><a href="#" class="lbAction" rel="deactivate">x</a></div>

        <?php
        {
            ECHO '<h2 class="popTitle2">Confirm Household Brands</h2>';
            ECHO "<p>Please note that household brands are allowed to be updated every 2 months. Do you want proceed?</p>";
            ECHO "<div class='clearfix right_align'>";
            ECHO "<a href='publish_campaign.php' class='button request4'>Yes</a>&nbsp;<a href='#' class='button_grey request4 lbAction' rel='deactivate'>No</a></div>";
        }

        ?>

    </div>
</body>
</html>

该项目处于后期阶段,实施新的设计或技术极其困难。如果使用的标准是原始的,请不要笑。我是一名数据库人,对PHP知之甚少。

非常感谢任何帮助。

0 个答案:

没有答案