F
F
ftdvshejfdk2015-12-29 22:54:11
Google
ftdvshejfdk, 2015-12-29 22:54:11

How to submit form data in Google Sheets?

There is a form whose name attribute is petuh

<form action="post.php" method="post">
 <textarea class="input" name="petuh" placeholder="Как зовут Вашего петуха?" required/></textarea>
 <input id="submit" class="submit" type="submit" name="submit" value="Отправить">
</form>

The post.php file contains the code:
<?php
  $petuh = $_POST['petuh'];
   if( $curl = curl_init() ){
      curl_setopt($curl,CURLOPT_URL,'https://docs.google.com/forms/d/XXXXYYYY/formResponse');
      curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
      curl_setopt($curl,CURLOPT_HEADER,true);
      if( $html = curl_exec($curl) ){
         curl_setopt($curl,CURLOPT_URL,'docs.google.com/forms/d/XXXXYYYY/formResponse');
         curl_setopt($curl,CURLOPT_POST,TRUE);
         curl_setopt($curl,CURLOPT_POSTFIELDS,"entry.XXXXXXX=$petuh&");
      $out = curl_exec($curl);
      echo "отправлено";
      }
      curl_close($curl);
   }

?>

XXXXYYYY - form ID
entry.XXXXXXX - ID given by Google Form when creating it. But I equate it to name = "petuh"
When submitting the form, it is sent and it says "sent", in the Google panel itself in the table a window pops up where it says "Response recorded".
But it still doesn't record ... Please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
likewater, 2019-03-07
@likewater

dontforget.pro/php/sendpravka-google-form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question