Lyss Posted February 12, 2007 Share Posted February 12, 2007 I'm using this php code for an upload form : <?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; $Upload=$HTTP_POST_FILES['Upload']; if($HTTP_POST_FILES['Upload']['tmp_name']==""){ } else if(!is_uploaded_file($HTTP_POST_FILES['Upload']['tmp_name'])){ $error.="<li>The file, ".$HTTP_POST_FILES['Upload']['name'].", was not uploaded!"; $errors=1; } if($errors==1) echo $error; else{ $image_part = date("h_i_s")."_".$HTTP_POST_FILES['Upload']['name']; $image_list[0] = $image_part; copy($HTTP_POST_FILES['Upload']['tmp_name'], "files/".$image_part); $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Upload: ".$where_form_is."/files/".$image_list[0]." "; $message = stripslashes($message); mail("[email protected]","Avatar Upload",$message,"From: [email protected]"); $make=fopen("admin/data.dat","a"); $to_put=""; $to_put .= $where_form_is."/files/".$image_list[0]." "; fwrite($make,$to_put); header("Refresh: 0;url=http://www.hp-ships.com/thanks.html"); ?><?php } ?> Which works fine. It sends an email with the file, however I need to be sent the other 4 pieces of information in the form. Can someone tell me how to configure my upload script so that it also sends content from two text fields: name and email, as well as two drop-down fields: pship and pship2? Any suggestions would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/38147-upload-form-with-text/ Share on other sites More sharing options...
Lodar Posted February 12, 2007 Share Posted February 12, 2007 I would modify the $message var, so that you can add the details of the text and drop down vars as well. $message .= "\n"; $message .= "Name: " . $_POST['name'] . "\n"; $message .= "Email: " . $_POST['email'] . "\n"; $message .= "PShip: " . $_POST['pship'] . "\n"; $message .= "PShip 2: " . $_POST['pship2'] . "\n"; $message .= "\n"; Place the above before the mail function and before or after the link to the file you create, form what I can see you are not sending the mail in html form, but then at my age my eyesight does play tricks on me Link to comment https://forums.phpfreaks.com/topic/38147-upload-form-with-text/#findComment-182672 Share on other sites More sharing options...
Lyss Posted February 13, 2007 Author Share Posted February 13, 2007 I tried the code but it didn't work. I've had a few suggestions from different forums but none of them are working! Link to comment https://forums.phpfreaks.com/topic/38147-upload-form-with-text/#findComment-183203 Share on other sites More sharing options...
Lodar Posted February 13, 2007 Share Posted February 13, 2007 What happens when you include my code with yours? Have you got the code so that the message var is populated as follows? $message="Upload: ".$where_form_is."/files/".$image_list[0]." $message .= "\n"; $message .= "Name: " . $_POST['name'] . "\n"; $message .= "Email: " . $_POST['email'] . "\n"; $message .= "PShip: " . $_POST['pship'] . "\n"; $message .= "PShip 2: " . $_POST['pship2'] . "\n"; $message .= "\n"; Are you using POST or GET on your forms method? And the fields you wish to move across are known as those field names you gave? Link to comment https://forums.phpfreaks.com/topic/38147-upload-form-with-text/#findComment-183375 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.