它不起作用,因为我认为它应该 [英] It isn't working as i think it should

查看:67
本文介绍了它不起作用,因为我认为它应该的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好这是我的php / javacript代码:

<!DOCTYPE html> 
& lt; html>
& lt; body>
& lt; script type = text / javascript charset = UTF-8>
var test = prompt( Hello!Greetings);
& lt; / script>
<?php
$ input = $ _GET [ test];
函数输入($ input){
if ($ input === Hello){
echo Hello;

}
其他 {
echo 你在说什么?;

};
};
输入($输入);

?>

& lt; form method =getaction =>
& lt; input id =testname =testvisibility =hidden/>
& lt; input type =textname =value>
& lt; input type =submitvalue =click me!>
& lt; / form>

& lt; / body>
& lt; / html>





应该这样工作

1.它应该通过javascript来获取我的价值。

2.该值应该运行。

3.以后PHP应该运行。

in详情

当我打开页面它应该给我问候msg然后我会说你好

之后在网页上它应该说你好。

用javascript和html很简单,但是我想使用php是可能的。



我尝试了什么:



我尝试重新加工变量,但它没有用。

解决方案

输入 =

_GET [ test];
函数输入(


输入){
如果


Hello this is my php/javacript code:

<!DOCTYPE html>
&lt;html>
&lt;body>
&lt;script type="text/javascript" charset="UTF-8">
	var test = prompt ("Hello! Greetings");
&lt;/script>
<?php
    $input =  $_GET["test"];
	function input($input) {
		if ($input === "Hello"){
			echo "Hello";
			
		}
		 else {
			echo "What are you saying?";
		
		};
	};
	input($input);
	
?>

&lt;form method="get" action="">
&lt;input id = "test" name="test" visibility = "hidden" />
&lt;input type="text" name="value">
&lt;input type="submit" value="click me"!>
&lt;/form>

&lt;/body>
&lt;/html>



It should work like this
1. It should take value from me which is by javascript.
2. That value should be run.
3. later PHP should run.
in details
when i open page it should give me greetings msg and then i will say Hello
after that On the web page it should say Hello.
It is simple with javascript and html but i want to use php is it possible.

What I have tried:

I tried redifining variables but it didn't work.

解决方案

input =


_GET["test"]; function input(


input) { if (


这篇关于它不起作用,因为我认为它应该的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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