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

Thread: PHP include

  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts

    PHP include

    I would like to somehow put this entire form into another file named image-form.php. I think I need an include statement but I'm not too sure. How do I go about doing that? Thank you

    PHP Code:
    <div id="mngl-upload-photo-tab" class="mngl-profile-tab mngl-hidden">
    <div style="color:#171717; font-weight:bold;">Upload Your Running Pictures Here >> 10 Image Limit per Upload</div><p>

    <!-- In another file -->
    <form action="upload.php" method="post" enctype="multipart/form-data" name="uploadform">
    <input type="hidden" name="MAX_FILE_SIZE" value="350000">
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr style="display:none"><td width="102"><strong>User ID:</strong></td>
    <td width="256" align="left"><input name="user_id" value="<?php echo $mngl_user->id?>" type="text" id="user_id" size="25"></td>
    <td width="256" align="left"><input name="user_name" value="<?php echo $mngl_user->first_name?>" type="text" id="user_name" size="5"></td>
    <td width="142" align="left">&nbsp;</td></tr><tr><td width="102"><strong>Image 1 File:</strong></td>
    <td width="256" align="left"><input name="picture1" type="file" id="picture1" size="25"></td>
    <td width="142" align="right"><input name="add" type="button" onClick="toggle_visibility('image_two')" value="Add Another Image"></td></tr></table>

    <br /><table width="500" border="0" cellspacing="0" cellpadding="0"> 
    <tr><td><input type="reset" value="Reset"></td>
    <td align="right"><input name="upload" type="submit" id="upload" value="Upload Images"></td></tr></table></form>
    <!-- In another file -->

    </div>

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Put whatever content you want into the other file, then just use the include function, pointing to the file... it'll take whatever is in the file, and place it into the current. Its just what you said/thought.

  • #3
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    include 'image-form.php'
    Put it where ever you want it to show up.

  • #4
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by bobgodwin View Post
    PHP Code:
    include 'image-form.php'
    Put it where ever you want it to show up.
    there is another way, i dont think it matters but i use this way cause its how i learnt to do it:

    PHP Code:
    include('image-form.php'); 
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags


  •  

    Posting Permissions

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