Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    uploading a php file with set variables

    hi, i've been looking at php upload forms, but i'm still not sure how to do this... if its possible.

    i have a list of records displayed in the admin section of a site. when you click an individual record, i need a php file to be uploaded (more added, than uploaded) in a specific location. the php file contains one variable that needs to be set dependant on a field in the record. so something like

    list item 1 fieldvalue=1
    list item 2 fieldvalue=2
    list item 3 fieldvalue=3

    click list item 1 and

    <?php

    blah blah blah

    variable=$fieldvalue

    blah

    ?>

    is uploaded to /admin/item$fieldvalue.php


    i hope that makes sense, its kinda hard to explain. thanks for any help.

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    fopen()
    fwrite()
    fclose()

    and when you write the code you need to call the variables funny.

    '$'.'varname=value;\n'

    or else it will assume $varname is a local variable you are attempting to access.

    you can also make this a function (although i don't see why you would need too)

    print makeVar('varname','value');

    function makeVar($n,$v)
    {
    $n=($n && strlen($n) > 0) ? $n : 'undefined';
    $v=($v && strlen($v) > 0) ? $v : 'undefined';
    return '$'.$n.'='.$v;
    }
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    or just put the $variables inside single-quotes...

  • #4
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by GJay
    or just put the $variables inside single-quotes...
    .... or that i guess... if you wanted to be fancey
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •