Jump to content

two POST variables get recognized the third not...


clausowitz

Recommended Posts

Hi,

 

I use a page to post a message on a bulletin board. When I send the POST to the next page which deals with the  process of saving the message, two variables get recognized but the third not. $name=$_POST['name']; and $message=$_POST['message']; get recognized but $image=$_POST['image']; not.

and I get the famous error Notice: Undefined index: image.

 

I don't see the difference between them.

<?php
$pageDisplay = '<form name="new_message" enctype="multipart/form-data" action="news/post.php" method="post"><p>Welcome <b>'. $logOptions_username . '</b> post your message here.<br></p>
<input type="hidden" name="post" value="yes">
<p>
Heading<br>
<input type="text" name="name" size="50">
</p>
<p>
Message<br>
<textarea name="message" rows="5" cols="50"></textarea>
</p>
<p>
Picture<br>
<input name="image" type="file"> [under construction]
</p>
<p>
<input type="submit" value=\'Post Message\'>
<input type="reset" value="Reset">
</p>
</form>';
?>

 

Marco

The uploaded file information will be available in the $_FILES array, not the $_POST array. I recommend that you read the file upload handling section of the php documentation - http://us2.php.net/manual/en/features.file-upload.php

But at that point the file still has to be uploaded. Just the path has been defined.

So I don't think there will be anything in the array.

 

Could I change the image into a string representing the path and send that to Post.php?

 

Marco

But at that point the file still has to be uploaded. Just the path has been defined.

So I don't think there will be anything in the array.

 

Could I change the image into a string representing the path and send that to Post.php?

 

Marco

what are you talking about?

Any information that is gathered using the "file" type input attribute is stored in the $_FILES array, this include the file name, size, tmp folder that it is stored in, etc...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.