-1

I have a form, and I'm checking to see if it's submitting properly to post. This is my first foray into POST, so other than rudimentary research and tutorial stuff, I'm having a lot of problems. I wrote a simple script to see if my form is working properly at all. The HTML is clipped to only show you the form; I do have a validation and all that.

There is no naming conflict, whether in the filenames or those of the variables, so I assume it's a syntax error or just me being that guy with no knowledge of post whatsoever.

Here's the HTML:

<html>
 <body>
  <form name="Involved" method="post" action="postest.php" target="_blank">
   Name: <br><input type="text" name="name" title="Your full name" style="color:#000" placeholder="Enter full name"/>
   <br><br>
   Email: <br><input type="text" name="email" title="Your email address" style="color:#000" placeholder="Enter email address"/>
   <br><br>
   How you can help: <br><textarea cols="18" rows="3" name="help" title="Service you want to provide" style="color:#000" placeholder="Please let us know of any ways you may be of assistance"></textarea>
   <br><br>
   <input type="submit" value="Submit" id=submitbox"/>
  </form>
 </body>
<html>

Here's the post (named postest):

<?php
    $name   =   $_POSTEST['name'];
    $email  =   $_POSTEST['email'];
    $help   =   $_POSTEST['help'];

    echo {$name}, {$email}, {$help};
?>

This post was derived from this tutorial.

Also, I might as well ask: How would I go about submitting information to be (semi)permanently stored on a spreadsheet for my later perusal? However, this is a secondary question.

Bucephalus
  • 13
  • 7
  • The variable is called $_POST. This is a spécial variable and you cannot change its name – Lorenz Meyer Jul 31 '14 at 21:57
  • 1
    `$_POSTEST` is what now? –  Jul 31 '14 at 21:57
  • For your other question you got to write the data to a csv using php file function. Though you keep it permanently or temporary it's upto you. – Jigar Tank Jul 31 '14 at 22:02
  • If you followed the tutorial correctly it uses `$_POST[]`… – Class Jul 31 '14 at 22:05
  • @Class You do realize that there's no call to be snide considering that, "if you followed the tutorial correctly" you could still assume that $_POST was a reference to the name of the program, right? It makes a lot of sense, considering to someone with no post experience whatsoever, it would appear that you were sending the data to a recipient called "postest" and that you would then retrieve it from the same name. – Bucephalus Aug 01 '14 at 01:28
  • @JigarTank That's really helpful; you've saved me a whole lot of fruitless experimentation with Google forms! Thanks. – Bucephalus Aug 01 '14 at 01:34
  • And whoever downvoted the question for whatever reason--why don't you bother explaining why? I'm assuming it's @Class , but that's not exactly fair to him or her either. The purpose of criticism is to help people do better in the future, not to snipe at people like an 11 yer old cheerleader trying to keep someone from sitting at the "popular" table. – Bucephalus Aug 01 '14 at 01:37

2 Answers2

0

Part of your problem is that you are using a variable you're calling $_POSTEST when really what you want is the $_POST array. $_POST is a special reserved variable in PHP (and needs to be referenced using that exact syntax) which is:

An associative array of variables passed to the current script via the HTTP POST method.

Reference: PHP Manual - http://php.net/manual/en/reserved.variables.post.php

So whatever input names and values you're passing into the PHP script come in via HTTP POST, and they'll be located in the $_POST array.

So using your example, it would be:

<?php
    $name   =   $_POST['name'];
    $email  =   $_POST['email'];
    $help   =   $_POST['help'];

    echo {$name}, {$email}, {$help};
?>
Josh KG
  • 5,050
  • 3
  • 20
  • 24
-1

There is not any $_POSTTEST array in php. Use $_POST.

nni6
  • 990
  • 6
  • 13
  • Please, explain why are you downvoting? – nni6 Jul 31 '14 at 22:00
  • Yeah, can we not downvote, clear, concise, and absolutely correct answers, please? That seems incredibly stupid. @nni6 I'm sorry. I would upvote you, but I need to be >15. – Bucephalus Aug 01 '14 at 01:25