Form probs with $_REQUEST and $_FILES

  • 16 years ago
    Something has me going nuts.

    I'm working on script which collects database info:

    1. Collect information about the tables in de db
    2. Collect information about the columns in the table
    3. Based on the columninfo (fieldname, type, ...) print out a form from which users can upload data to the table in the db

    Everything worked fine until I tried to implement the uploading of files. For some idiot reason the filename collected from $_FILES is being put at the end of string I'm using to add to the database.

    I'm not going to post the script here as it really is too big.

    Can someone give me a short example of how to write the following form to a database:

    Code:

    <input type="text" name="textvar">
    <input type="file" name="filevar">
    <input type="text" name="textvar2">
    <input type="text" name="textvar3">


    What the script should do is collect both vars and their values using $_REQUEST, $_POST or /and $_FILES.

    Each value should then be added to another var called e.g. $happyvar, which afterwards will be used in the INSERT command for the MySQL db.

    As I don't know what the vars are going to be used in a tabel simply using $textvar, $filevar and $filevar_name won't do the trick.

    As far as I can see the problem has something to do with the combination of $_REQUEST and $_FILES I am using.

    Someone please help!

    Thx,

    Steven

    Note: I know how to use db etc., so you I really only interested in how to collect the data of this mixed form ...








Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If debugging is the process of removing software bugs, then programming must be the process of putting them in.” - Edsger Dijkstra