Onichan
Onichan

Reputation: 4526

Unable to Get Text Input from Form

For some reason I can't get the text input from the form. I'm successfully able to get the file.

<form action="upload.php" method="post" enctype="multipart/form-data" id="msform">
<fieldset>
<h2 class="fs-title">Upload Photo</h2>
  Select Image: <input type="file" name="image">
  Photo Name: <input type="text" name="photoName">
  Photo Name2: <input type="text" name="photoName">
  <input type="submit" value="Upload Image" name="submit" class="submit action-button">
</fieldset></form>

This is my code to get the form data:

if ( isset( $_FILES['image'] ) ) {

  // save file to Parse
  $file = ParseFile::createFromData( file_get_contents( $_FILES['image']['tmp_name'] ), $_FILES['image']['name']  );
  $file->save();

  $foo = $_POST['photoName'];
  echo $foo;

$foo does not display. I've tried using $_GET and $_REQUEST

Upvotes: 1

Views: 40

Answers (1)

Moppo
Moppo

Reputation: 19285

Your second input overrides the first. Try to make a:

var_dump($_POST); 

at the beginning of the php script, so you will see what is arriving as a parameter

Upvotes: 1

Related Questions