English 中文(简体)
如何将回落的 Java字功能分配到一个PHP变量中,并在一个库里使用?
原标题:How to assign a returned Javascript function to a PHP variable and use in an SQL Query?

我使用Javascript获得成员_id url参数,然后需要将这一数值分配给我用在KQery的PHP变量。 当我简单地重复购买力平价变量时,一切都看好,但如果我试图将购买力平价变量列入我通过POST提交的QQ.,我就与Kall Query发生错误。

    <script>
var param1var = getQueryVariable("member_id");
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  alert( Query Variable   + variable +   not found );
}
</script>

<?php $foo="<script type= text/javascript >
document.write(getQueryVariable( member_id ));
</script>";
?>

文 件: 页: 1 第1行的书写(目标质量(成员))*

最佳回答

这是因为PHP在服务器上运行,而贵联在客户上执行。 仅此,你就能够以其他方式做事。

<script type="text/javascript">
    var myval =  <?php echo $myphpval ?> ;
</script>

之所以能够做到这一点,是因为在联合材料对客户执行之前,PHP在服务器上安装。 但是,如果你想将一份联合材料寄给PHP的书本,那么,在人力部装满之后,通常通过美国宇宙航空研究开发机构发出呼吁,你需要这样做。

问题回答

PHP在服务器上执行,Javascript在客户身上执行。 你们所有的实验室都正在生产一个小型的 Java版。 在服务器上安装了javascript。 它被送到客户手中,并在浏览器上执行,很久之后,PHP已经关闭。

To send data from Javascript back to PHP, you must use an AJAX call, or a normal form submission of some sort.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签