开发者

Triggering php from html

I am very new to PHP world. In my html page I am passing some variable using GET method to my php file. This php file exist in the same directory where my html file is. But on triggering the action by clicking the submit Button in the html file开发者_如何学运维 I am not able to trigger the php file(php file is not displaying the html format)

If I replace ACTION=”some_file.php” to ACTION=”some_file.html” the html file is getting open.What's going wrong here. I am using wamp stack.

Thnx, Kaushik


First try to open some_file.php manually to see if PHP works fine, ex:

http://localhost/some_file.php


Try some lecturing :) http://apptools.com/phptools/forms/forms1.php

For your example try writing the html in the php file so you have the test.php file like this:

<?php

if($_REQUEST['buttonPressed']){
    // process form info here
}

?>

<html>
   <form action="test.php">
       <!-- some other inputs here -->
       <input type="submit" name="buttonPressed" value="Submit me"/>
   </form>
</html>


The authoritative reference for PHP is http://www.php.net/manual/en/ It is a bit much to wade through at once, but it's something you'll probably end up going back to over and over.

For now check out http://www.w3schools.com/php/php_syntax.asp and http://www.w3schools.com/php/php_forms.asp for an intro to basic php form handling.

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜