M
M
Mark_Light2021-07-12 18:31:07
PHP
Mark_Light, 2021-07-12 18:31:07

How to run php script directly in html?

Good afternoon! I ’ll immediately turn to the question:
Is it possible to run a php script directly in html without the help of a file, i.e. Replace so that the php script itself is in HTML and can be executed when the Ps button is pressed, the script is assigned to send order details to telegrams
<form action="login.php" method="post">

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2021-07-12
@Mark_Light

Something like this is possible:

<?php
// form.php

// во время загрузки станицы проверить была ли отправлена форма:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 // ... сделать то что вам нужно
}
?>
<form action="" method="post">

The point is that the form submits data to the same page, in fact it just reloads, but when reloaded, the server can process the data from the form.

T
ThunderCat, 2021-07-12
@ThunderCat

php is running ON THE SERVER. Before you get the html on the client, you can say getting it on the client is the result of the php script running on the server. To this the answer is no.

the script is assigned to send order details to telegram
Nothing to do with the first part of the question, I would say that the idiocy of the first part of the question is unnecessarily complicated. Most likely, you need something completely different, but you are dragging a fantastic implementation option into your Wishlist, generated by your deep misunderstanding of the web stack.
If you bother to explain what you really need, maybe they will tell you something with the implementation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question