How to make a script form?

I’m just getting started with PHP, so don’t kick or scold me. Here is the script:

<?php
set_time_limit(0);
//-----------------//
$komy = "Alex";
$otkogo = "test";
$msg = "hello word";
//-----------------//
/*  - */
$ch = curl_init("http://***********.ru/ccc-php/sms/index.php");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.4) Gecko/2008102920 AdCentriaIM/1.7 Firefox/3.0.4");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "action=send&msisdn=".urlencode($komy)."&from=".urlencode($otkogo)."&msg=".urlencode($msg)."&submit=Send");
curl_setopt($ch, CURLOPT_REFERER, "http://*********.ru/index.php");
curl_setopt($ch, CURLOPT_COOKIEJAR, "./cook");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res_index  = curl_exec($ch);
?>

How can I make the form fillable on the site, and not in the script itself? As soon as I didn’t do it, I didn’t succeed.


Answer 1, authority 100%

It seems to work for html

<form action="name.php">
 <p><b>** **:</b></p>
  <p><input type="text" name="** **" value="** **"> ****<Br/></p>
<p><b>** **:</b></p>
  <p><input type="text" name="** **" value="** **"> ****<Br/></p>
<p><b>** :**</b></p>
  <p><input type="text" name="** **" value="** **">****<Br/></p>
</form>

name.php – processing file
the test is marked with – here you need to substitute your data
In the file name.php
Displaying variables from browser url

<?
    $  = $_POST[' '];
    $  = $_POST[' '];
    $  = $_POST[' '];
    ...
?>

//Don’t forget to replace “field name”

If you contact me, then tell me more specifically what forms you need or write to Skype node_xaker I will help you not to litter on the forum


Answer 2, authority 100%

Here, scenarios with php formsare described in sufficient detail.

Sort of like this:

<form method=POST>
    : <input type='text' name='komu'><br>
     : <input type='text' name='otkogo'><br>
    : <input type='text' name="msg"><br>
   <input type="submit" value="" />
</form>

Insert this in the text before the script.

And replace this instead

$komy = "Alex";
$otkogo = "test";
$msg = "hello word";

for this

$komy = $_POST['komu'];
$otkogo = $_POST['otkogo'];
$msg = $_POST['msg'];

Answer 3, authority 100%

$komy = "Alex";
 $otkogo = "test";

The first thing I want to say is to tie it with such variable names. They could be called $to and $from or $recipient and $sender. But not transliteration.

Well, the form is simple. You set the action form attribute on your script and after submitting you get all the data from this form in the $_POST array. You work with him.