0

I have a form

<form action="welcome.php" method="post" ........................">

      <button id=......................ERATE NEW ....</button>
      <br/><br/>
      <div class="form-field">
        <label for...............">....... TEST</label>
        <br/>
        <textarea id=...........................="false"></textarea>
        <span class="clipSp............ successfully copied to clipboard" ></span>
        <br/>
      </div>
      <br/>

      <div clas..........content">
        <div>ADDRESS
          <br/>
          <span>{{vm.displayAddress}}</span>
        </div>
      </div>
      <button class="wButton fade" type="submit">REGISTER ACCOUNT</button>
      <span class="divider-2"></span>
      <button class="wButton fade" type="reset" ng-click="vm.back()">BACK</button>
      .
      .
      .
      .

Then i have this "welcome.php" file.

if(!empty($_POST['formdesiredpost'])){
    $var  = $_POST['formdesiredpost'];
    file_put_contents("dat‌​a.txt", $var . "\n", FILE_APPEND); 
    header("Location: https://randomwebsiteredirect.com"); 
    exit();
}

Its supposed to post the desired value from the form (textarea) into a txt file, data.txt and then redirect to a website.
The problem is that it only works for short length inputs. I mean aprox (15 characters) , if I input more than 15 , like 70, it simply redirects to blank welcome.php and does nothing.

Any clue of what may be happening?

Bibhudatta Sahoo
  • 4,808
  • 2
  • 27
  • 51
romanturbo
  • 87
  • 1
  • 8

1 Answers1

0

On your html you don't have the "formdesiredpost" field. Please check does there exist "formdesiredpost" field.

And in your welcome.php, on the top side of your code add error reporting function:

error_reporting(0);

To see what happened after send data to welcome.php

Works fine:

index.php:

<form action="welcome.php" method="post">
<textarea name="formdesiredpost"></textarea>
<input type="submit" value="submit">
</form>

welcome.php

<?php
if(!empty($_POST['formdesiredpost'])){
    $var  = $_POST['formdesiredpost'];
    file_put_contents("data.txt", $var . "\n", FILE_APPEND); 
    header("Location: https://randomwebsiteredirect.com"); 
    exit();
}
?>

And please check your character limits of fields:
Limit number of characters allowed in form input text field