> where the method is "enctype=multipart/form-data".
Okay, Arun -
The METHOD of the form is always GET or POST. ENCTYPE stands for "Encoding
Type", and tells the web server in which format the form data will be sent.
All your form input variables are still accessed through $_GET or $_POST.
PHP automatically takes the data from <INPUT type="file"> inputs and puts
them in a special array named $_FILES.
This would've been immediately apparent if you had taken about 5 minutes to
write this test page:
---- file_test.php ----
<html>
<body>
<FORM method="post" enctype="multipart/form-data" action="<?php echo
$PHP_SELF; ?>" >
Username: <INPUT type="text" name="the_username" /> <br />
File : <INPUT type="File" name="the_file" />
<INPUT type="submit" name="the_submit" value="send file" />
</FORM>
<hr />
<pre>
<?php
echo "_POST is: ";
print_r($_POST);
echo "<HR />\n_FILES is:";
print_r($_FILES);
?>
</pre>
</body>
</html>
-------------------------
By submitting the form, you'd have seen this output:
_POST is: Array
(
[username] => asdf
)
----------------------------------------------------------------------------
----
_FILES is:Array
(
[the_file] => Array
(
[name] => ntd.txt
[type] => text/plain
[tmp_name] => C:\WINNT\php6.tmp
[error] => 0
[size] => 3
)
)
The following might make me seem like an *******, but I have to say it.
You've been a regular poster to pro_php that by now, I'd have hoped that all
the answers to your questions would've taught you a little bit more about
problem solving by now. The majority of the questions you've asked are
really easily answered by a very minimal amount of testing. It takes about
as much time to write a simple test script as it does to write the email in
the first place.
I think that if you plan to continue a career in programming, whatever the
language, you need to train your ability to solve problems. Make a guess.
Look at the FORM tag -- it's
<FORM method="POST" enctype="multipart/form-data" action="page.php">
The form METHOD is the same as it's been for countless other forms and
scripts you've written.
Your last problem had to do with multidimensional (MD) arrays, if I recall
correctly.
First you asked how to assign to MD arrays, then you asked how to declare MD
arrays, then you asked how to append to MD arrays.
Arrays are just variables. You don't have to do anything special to declare
an integer or a string or a boolean. You don't have to do anything special
to declare a single dimensional array. Why would you need to do anything
special for a MD array?
Then you had a problem assigning to a MD array. You added a function
something like this to your code:
function add_data($row, $col, $data)
{
$my_array ... // what do I do here???
}
Did you even try the obvious?? $my_array[$row][$col] = $data.
Did you even read the manual at http://www.php.net/types.array ??!?
Everyone on the lists are here to help each other, and we take time out of
our busy schedules so that other people can learn and become better
programmers.
There's two sides to the commitment -- the people who answer questions
commit their time and expertise to help less experienced programmers learn
by example.
The people who _ASK_ the questions have the obligation to _TRY_ to follow
that example and become better.
I don't feel that you're meeting your end of the bargain. It seems that you
expect US to write your code for you, one question at a time. You don't
seem to apply the lessons learned in ONE problem to the next -- many of your
questions have been very similar.
This isn't fair to those of us who are pestered to continually answer your
questions.
Nor is it fair to the other subscribers of pro_php who have legitimate
questions but must sift through emails asking how to do something trivial
like assign to an array.
I suggest that next time you have a question, find the answer for yourself.
Read the manual. Search the web on google. Look through the list archives.
Make a guess at what the answer is and write a small test script to see if
you're right. If you're not, make another guess. And another.
That's how you learn -- by DOING it. Not by asking someone for all the
answers.
Take care,
nik