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 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    61
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Form with upload problem

    I have an upload form thats works great with my php script. When I add other fields such as customers name, email address etc, it doesn't work. Is there a script that "post" both text fields and upload together.

    php Script
    PHP Code:
    <?php 
    $target 
    "upload/"
    $target $target basename$_FILES['uploaded']['name']) ; 
    $ok=1

    //This is our size condition 
    if ($uploaded_size 350000

    echo 
    "Your file is too large.<br>"
    $ok=0


    //This is our limit file type condition 
    if ($uploaded_type =="text/php"

    echo 
    "No PHP files<br>"
    $ok=0


    //Here we check that $ok was not set to 0 by an error 
    if ($ok==0

    Echo 
    "Sorry your file was not uploaded"


    //If everything is ok we try to upload it 
    else 

    if(
    move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 

    echo 
    "The file "basename$_FILES['uploadedfile']['name']). " has been uploaded"

    else 

    echo 
    "Sorry, there was a problem uploading your file, please try again."


    ?>
    Form
    Code:
    <form method='post' action='http://blackwolf-graphics.co.uk/cgi-bin/FormMail.pl'>
    <input type='hidden' name='recipient' value='support@blackwolf-graphics.co.uk'> 
    <input type='hidden' name='subject' value='E-form - Returns'> 
    <input type='hidden' name='redirect' value='http://blackwolf-graphics.co.uk/thankyou.html'>
    <table cellpadding="2" cellspacing="0" border="0" bgcolor="#000000">
    <tr>
    <td>
    <font face="Verdana" size="2" color="#9bd2f1"></font>
     <div style="" id="mainmsg"> </div>
    
    </td>
    </tr>
    </table>
    
    <br>
    
    <table cellpadding="2" cellspacing="0" border="0" bgcolor="#000000">
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">First Name / Last Name</font></td>
     <td>
    <input type="text" name="name" value="" maxlength="100" size="30"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Your Email Address</font></td>
     <td>
    <input type="text" name="email" value="" maxlength="100" size="30"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">House Name / Number</font></td>
     <td>
    <input type="text" name="house number" value="" maxlength="100" size="20"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Postal Code</font></td>
     <td>
    <input type="text" name="post code" value="" maxlength="100" size="7"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Date Purchased (DD/MM/YY)</font></td>
     <td>
    <input type="text" name="date purchased" value="" maxlength="100" size="8"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Paypal Transaction No</font></td>
     <td>
    <input type="text" name="paypal transaction no" value="" maxlength="100" size="20"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">No of items returning</font></td>
     <td>
    <select name="items"><option value="01">01</option><option value="02">02</option><option value="03">03</option><option value="04">04</option><option value="05">05</option><option value="06">06</option><option value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option value="11+">11+</option></select> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Item Description</font></td>
     <td>
    <textarea name="description" cols="60" rows="10"></textarea><br> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">What is required?</font></td>
     <td>
    <input type=radio name="What is Required"  value="Refund (less postage and any ebay fees)" id="radio80"><font face="Verdana" size="2" color="#9bd2f1"><label for="radio80">Refund (less postage and any ebay fees)</label></font><br><input type=radio name="What is Required" value="Replacement item" id="radio81"><font face="Verdana" size="2" color="#9bd2f1"><label for="radio81">Replacement item</label></font><br> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Damaged Item? Any pictures?</font></td>
     <td>
    <input type="file" name="attachment" value="" size="60"> </td>
    </tr>      
    
    <tr valign="top">
     <td nowrap><font face="Verdana" size="2" color="#9bd2f1">Message to BWG</font></td>
     <td>
    <textarea name="message" cols="60" rows="10"></textarea><br> <div style="position: absolute; left: 1800px; top: 20px;"></div></td>
    </tr>      
    <tr>
     <td align="left">
    <input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none;">
    <input type="submit" class="btn" value="Submit Form" name="Submit">    <input type="reset" class="btn" value="  Reset Form  " name="Clear"></td>
    </tr>
    <tr>
    <td colspan=2 align="center">
    <br>
    </td>
    </tr>
    </table>                      
    
    </form>

  • #2
    Regular Coder Pepe, the bull's Avatar
    Join Date
    Feb 2005
    Location
    Vancouver, WA
    Posts
    163
    Thanks
    1
    Thanked 16 Times in 16 Posts
    That sounds like a question for the PHP forum.
    Pepe, the bull

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    When I add other fields such as customers name, email address etc, it doesn't work. Is there a script that "post" both text fields and upload together.
    That sounds like a question for the PHP forum.
    ... though the issue might be due to the errors in your markup.

    PS: Never use tables to layout your form, think about accessible forms.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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