Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-13-2009, 05:52 PM   PM User | #1
blackwolf
New Coder

 
Join Date: Oct 2008
Posts: 61
Thanks: 7
Thanked 0 Times in 0 Posts
blackwolf is an unknown quantity at this point
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>
blackwolf is offline   Reply With Quote
Old 02-13-2009, 10:37 PM   PM User | #2
Pepe, the bull
Regular Coder

 
Pepe, the bull's Avatar
 
Join Date: Feb 2005
Location: Vancouver, WA
Posts: 163
Thanks: 1
Thanked 16 Times in 16 Posts
Pepe, the bull is on a distinguished road
That sounds like a question for the PHP forum.
__________________
Pepe, the bull
Pepe, the bull is offline   Reply With Quote
Old 02-14-2009, 08:02 AM   PM User | #3
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
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.
Quote:
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.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:51 PM.


Advertisement
Log in to turn off these ads.