No announcement yet.

Help with adjusting send.php (lead capture)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with adjusting send.php (lead capture)

    Hello guys,

    I have a form on our websites that is collecting leads via Lead capture.

    Because I am noob I need your help.

    I have a form with code:
    <!DOCTYPE html>
    <html lang="en">
      <meta charset="UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Cenová nabídka</title>
      <!-- CSS only -->
    <link href="" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
    <link href="style.css" rel="stylesheet">
    <link rel="preconnect" href="">
    <link rel="preconnect" href="" crossorigin>
    <link href="" rel="stylesheet">
      <div class="container py-4">
        <header class="pb-3 mb-4 border-bottom">
        <form method="post" action="./send.php">
            <div class="p-5 mb-4 rounded-3 form">
                <div class="mb-3">
                    <label for="firstName" class="form-label">Křestní jméno*</label>
                    <input type="text" class="form-control" id="firstName" name="firstName" placeholder="Jan">
                <div class="mb-3">
                    <label for="lastName" class="form-label">Příjmení*</label>
                    <input type="text" class="form-control" id="lastName" name="lastName" placeholder="Novák">
                <div class="mb-3">
                    <label for="emailAddress" class="form-label">Emailová adresa*</label>
                    <input type="email" class="form-control" id="emailAddress" name="emailAddress" placeholder="">
                <div class="mb-3">
                    <label for="phoneNumber" class="form-label">Telefonní číslo*</label>
                    <input type="text" class="form-control" id="phoneNumber" name="phoneNumber" placeholder="+420702123456">
                <div class="mb-3">
                    <label for="addressState" class="form-label">Kraj</label>
                    <select class="form-control" id="addressState" name="addressState" placeholder="Jihomoravský kraj">
                      <option value="Hlavní město Praha">Hlavní město Praha</option>
                      <option value="Jihočeský kraj">Jihočeský kraj</option>
                      <option value="Jihomoravský kraj">Jihomoravský kraj</option>
                      <option value="Karlovarský kraj">Karlovarský kraj</option>
                      <option value="Kraj Vysočina">Kraj Vysočina</option>
                      <option value="Královéhradecký kraj">Královéhradecký kraj</option>
                      <option value="Liberecký kraj">Liberecký kraj</option>
                      <option value="Moravskoslezský kraj">Moravskoslezský kraj</option>
                      <option value="Olomoucký kraj">Olomoucký kraj</option>
                      <option value="Pardubický kraj">Pardubický kraj</option>
                      <option value="Plzeňský kraj">Plzeňský kraj</option>
                      <option value="Středočeský kraj">Středočeský kraj</option>
                      <option value="Ústecký kraj">Ústecký kraj</option>
                      <option value="Zlínský kraj">Zlínský kraj</option>
                <button type="submit" class="button btn-primary">Odeslat formulář</button>
    <!-- JavaScript Bundle with Popper -->
    <script src="" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
    and I have a php script (send.php) to send the request with code:
        if(empty($_POST['emailAddress']) || empty($_POST['firstName']) || empty($_POST['lastName'])) {
            echo "Prosím vyplňte všechny povinné pole";
        $params = array(
            'emailAddress'       => $_POST['emailAddress'],
            'firstName'          => $_POST['firstName'],
            'lastName'           => $_POST['lastName'],
            'addressState'       => $_POST['addressState'],
            'phoneNumber'        => $_POST['phoneNumber'],
            'descriptionNew'     => $_POST['TestPoznamka']
        $thankYouURL = "";
        $curl = curl_init();
        curl_setopt_array($curl, array(
          CURLOPT_URL           => "",
          CURLOPT_RETURNTRANSFER  => true,
          CURLOPT_ENCODING        => "",
          CURLOPT_MAXREDIRS     => 10,
          CURLOPT_TIMEOUT         => 30,
          CURLOPT_POSTFIELDS    => json_encode($params),
          CURLOPT_HTTPHEADER    => array(
            "Cache-Control: no-cache",
            "Content-Type: application/json"
        $response = curl_exec($curl);
        $err    = curl_error($curl);
        header("Location: $thankYouURL")
    Everything is working as expected but I would love to have one more field passed to our system with hardcoded value and without the field being present in the form. Could you please tell me how to adjust the send.php script to be able to achieve my needs?

    I thought little adjustment of the $params in send.php will do the magic, but I am not able to pass hardcoded value to the field "descriptionNew"

    I tried this syntax where I was trying to send string "TestPoznamka" to the field descriptionNew, but the Lead was created with empty description:
    $params = array(
            'emailAddress'       => $_POST['emailAddress'],
            'firstName'          => $_POST['firstName'],
            'lastName'           => $_POST['lastName'],
            'addressState'       => $_POST['addressState'],
            'phoneNumber'        => $_POST['phoneNumber'],
            'descriptionNew'     => $_POST['TestPoznamka']
    Thanks a lot.

  • #2
    Did you try with something like this?

    'descriptionNew' => 'TestPoznamka'

    Usually ChatGPT can help with these kind of questions


    • #3
      on the lead capture make sure you add the field to the payload fields.

      Then you can set up a hidden input in your form with value you wanted and this field will not be visible but will be passed to the send.php and then just add the field to be send with the payload data from the form.

      Add this before the select box :

      PHP Code:
      <div class="mb-3" style="display: none;">
      input type="hidden" id="testPoznamka" name="testPoznamka" value="TestPoznamka">
      Now it will be captured by your send.php and submitted to the crm just make sure the descriptionNew field is added to the lead capture payload fields
      Last edited by rabii; 05-30-2023, 01:29 PM.


      • Jakub Grufik
        Jakub Grufik commented
        Editing a comment
        hello mate, that is awesome solution! thank you very much