首页 > 解决方案 > How to call the php code from an action in the same file

问题描述

<form action="??" method="post">
<input type="text" id="name" />
<button type="submit">Submit</button>
</form>
<?php
    //php
?>

Now, how Can I run a php in the same file? Because If I want to call it from another file for example 'something.php' I'll put in the form action="something.php' and it will work.

I am new in php and my english is not good so it is difficult for me to explain you. I was looking for this answer on this page but there is nothing what Can I understand.

I don't want to send the code because most of it is in Polish so it wouldn't make sense. This form will be used to send an email.

标签: phphtml

解决方案


如果您action完全省略该属性,表单将发布到同一页面:

<form method="post">

推荐阅读