Jump to content

make additional upload form fields appear


Mr.Canuck

Recommended Posts

I have an upload form (which can be seen here: http://kmkwebdevelopment.com/formtest/upload.php). There are currently 5 "upload" fields, and I would like to have it so that if a person requires more "upload" fields, they can click on a + sign or something and it will make 15 more "upload" fields drop down (so they can upload a total of 20 files at a time). Does anyone know a good way to do this?

 

Thanks.

 

<?php error_reporting(0);

foreach($_POST as $key => $value){
    	if (is_array($value)) {
    		$_values[$key] = join("%,% ",$value);
    	}else $_values[$key] = $value;
      $_values[$key]=stripslashes($_values[$key]);
      }

if (!isset($_POST["_referer"])) {
	@$_referer = $_SERVER["HTTP_REFERER"];
}else $_referer = $_POST["_referer"];


$_ErrorList = array();

function mark_if_error($_field_name, $_old_style = ""){
global $_ErrorList;
	$flag=false;
	foreach($_ErrorList as $_error_item_name){
		if ($_error_item_name==$_field_name) {
			$flag=true;
		}
}
echo $flag ? "style=\"background-color: #FFCCBA; border: solid 1px #D63301;\"" : $_old_style;
}

function IsThereErrors($form, $_isdisplay) {
  global $_POST, $_FILES, $_values, $_ErrorList;
  $flag = false;
  if ($form > -1) {
  if ($_isdisplay) {
  	echo "<div style=\"border: 1px solid; margin: 10px auto; padding:15px 10px 15px 50px; background-repeat: no-repeat; background-position: 10px center; color: #D63301; background-color: #FFCCBA; max-width:600px; background-image:url('".$_SERVER["PHP_SELF"]."?image=warning');\">";
  }

  $flag = false;

  $req[0][] =  array("firstname", "firstname is required.");
  $req[0][] =  array("lastname", "lastname is required.");
  $req[0][] =  array("email", "email is required.");
  $req[0][] =  array("companynumber", "companynumber is required.");
  foreach($req[$form] as $field){
    if (!isset($_values[$field[0]]) or ($_values[$field[0]]=="")) {
      $flag = true;
      if ($_isdisplay) {
      	echo $field[1]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

  $files_req[0][] =  array("upload1", "upload1 is required.");
  foreach($files_req[$form] as $field){
    if (@$_FILES[$field[0]]["name"]=="") {
      $flag = true;
      if ($_isdisplay) {
      	echo $field[1]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

  $fields[0][] = array("email", '/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/', true, "email should be valid e-mail address.");
  $fields[0][] = array("companynumber", '/^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/', true, "companynumber should contain integer or floating point value only.");
  foreach($fields[$form] as $field){
    if (!(preg_match($field[1],$_values[$field[0]])==$field[2]) && $_values[$field[0]]!=""){
      $flag = true;
      if ($_isdisplay) {
      	echo $field[3]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

	  $files[0][] = array("upload1", "true", "true", "You are trying to upload file with not allowed extension.", "true", "");
	  $files[0][] = array("upload2", "true", "true", "", "true", "");
	  $files[0][] = array("upload3", "true", "true", "", "true", "");
	  $files[0][] = array("upload4", "true", "true", "", "true", "");
	  $files[0][] = array("upload5", "true", "true", "", "true", "");
	  foreach($files[$form] as $file){
     $str = $file[1];
     if (eval("if($str){return true;}")) {
        $_values[$file[0]] = $_FILES[$file[0]]["name"];
        $dirs = explode("/","attachments//");
        $cur_dir =".";
        foreach($dirs as $dir){
        $cur_dir = $cur_dir."/".$dir;
        if (!@opendir($cur_dir)) { mkdir($cur_dir, 0777);}}
        $_values[$file[0]."_real-name"] = "attachments/".date("YmdHis")."_".$_FILES[$file[0]]["name"]."_secure";
        copy($_FILES[$file[0]]["tmp_name"],$_values[$file[0]."_real-name"]);
        @unlink($_FILES[$file[0]]["tmp_name"]);
     }else{
      $flag=true;
      if ($_isdisplay) {
      	//$ExtFltr = $file[2];
      	//$FileSize = $file[4];
        if (!eval("if($file[2]){return true;}")){echo $file[3];}
        if (!eval("if($file[4]){return true;}")){echo $file[5];}
      	$_ErrorList[] = $file[0];
      }
     }
  }

  if ($_isdisplay) {
  	echo "</div>";
  }
  }
  return $flag;
}


function display_page_upload_form($_iserrors) {
   global $_values, $_referer;?>
<html><SCRIPT LANGUAGE = "JavaScript">
var fields = {
"companynumber" : ["companynumber", /^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/, true, "Your Company Number should be entered with no spaces or hyphens."],
"email" : ["email", /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/, true, "Please ensure your email address is in a valid format."]
};
var req = {
"upload1" : ["upload1", "upload1 is required."],
"companynumber" : ["companynumber", "company number is required."],
"email" : ["email", "email is required."],
"lastname" : ["lastname", "last name is required."],
"firstname" : ["firstname", "first name is required."]
};
var validate_form = true;function CheckForm(){HideAllErrors();if(!validate_form)return true;var LastErrorField=null;for(var i in fields){isError=ValidateField(fields[i][0],fields[i][1],fields[i][2],fields[i][3]);if(isError)LastErrorField=isError}for(var i in req){isError=isFilled(req[i][0],req[i][1]);if(isError)LastErrorField=isError}if(LastErrorField){LastErrorField.focus();return false}else return true}function ShowTooltip(type,field,message){var IE='\v'=='v';var container;if(!(container=document.getElementById('error_list'))){var container=(IE)?(document.createElement('<div name="error_list">')):(document.createElement('div'));container=document.createElement('div');container.setAttribute('id','error_list');document.body.appendChild(container)}if(!document.getElementById(field+'_tooltip')){var elem=(IE)?(document.createElement('<div name="myName">')):(document.createElement('div'));var elem2=(IE)?(document.createElement('<div name="myName2">')):(document.createElement('div'));div_id=field+'_tooltip';elem=document.createElement('div');elem.setAttribute('id',div_id);elem.className="fe-"+type+"-container";elem.onmouseover=function(){MoveDivToTop(this)};elem.onclick=function(){HideTooltip(this.id)};elem2=document.createElement('div');elem2.className="fe-"+type;elem2.innerHTML=message;parentField=document.getElementsByName(field);var f=0;while(parentField[f].type=='hidden')f++;with(elem.style){top=findPos(parentField[f])[0]+'px';left=findPos(parentField[f])[1]+parentField[f].offsetWidth+'px'}elem.appendChild(elem2);container.appendChild(elem)}}function ValidateField(name,rule,condition,message){fld=document.getElementsByName(name);var i=0;while(fld[i].type=='hidden')i++;if(!(((fld[i].value.match(rule)!=null)==condition)||(fld[i].value==""))){ShowTooltip('error',fld[i].name,message);return fld[i]}return null}function isFilled(name,message){fld=document.getElementsByName(name);var isFilled=false;var i=0;while(fld[i].type=='hidden')i++;var obj=fld[i];for(j=i;j<fld.length;j++){if((fld[j].type=='checkbox')||(fld[j].type=='radio')){if(fld[j].checked)isFilled=true}else{if(fld[j].value!="")isFilled=true}}if(isFilled){return null}else{ShowTooltip('error',name,message);return obj}}function FieldBlur(elemId){HideTooltip(elemId);fieldName=elemId.replace(/(\S{0,})_tooltip/,"$1");if(typeof fields[fieldName]!='undefined'){ValidateField(fields[fieldName][0],fields[fieldName][1],fields[fieldName][2],fields[fieldName][3])}if(typeof req[fieldName]!='undefined'){isFilled(req[fieldName][0],req[fieldName][1])}}function HideTooltip(elemId){var elem=document.getElementById(elemId);var parent=document.getElementById('error_list');if((elem)&&(parent))parent.removeChild(elem)}function HideAllErrors(){error_container=document.getElementById('error_list');if(error_container!=null){while(error_container.childNodes.length>0){error_container.removeChild(error_container.firstChild)}}}function MoveDivToTop(div_to_top){div_container=document.getElementById('error_list');for(i=0;i<div_container.childNodes.length;i++)div_container.childNodes[i].style.zIndex="998";div_to_top.style.zIndex="999"}function findPos(obj){var curleft=curtop=0;do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent);return[curtop,curleft]}
</SCRIPT>
<style type="text/css"> .form_expert_style {display: none;}.fe-info,.fe-error{font:13px arial,helvetica,verdana,sans-serif;padding:2px;position:relative;top:-7px}.fe-error{border:solid 1px #d51007;background:#fbe3e4;color:#d51007}.fe-info{border:solid 1px #0187c5;background:#eff9ff;color:#0187c5}.fe-info-container,.fe-error-container{position:absolute;padding:0;border-left:8px solid transparent;-border-left:8px solid white;filter:progid:DXImageTransform.Microsoft.Chroma(color="white")}.fe-error-container{border-top:8px solid #d00}.fe-info-container{border-top:8px solid #0187c5} </style>

<form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);">
<?php IsThereErrors("0", $_iserrors); ?>
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="1">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>

<table>
<tr>
<td>First Name *</td>
<td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td>
</tr>
<tr>
<td>Last Name *</td>
<td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td>
</tr>
<tr>
<td>E-mail *</td>
<td><input type='text' size='30' name='email'  onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td>
</tr>
<tr>
<td>Company Number *</td>
<td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td>
</tr> 
<tr>
<td>Upload *</td>
<td><input class="image" type='file' size='30' name='upload1' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("upload1", "") ?>></td>
</tr>
<tr>
<td>Upload</td>
<td><input class="image" type='file' size='30' name='upload2'></td>
</tr>
<tr>
<td>Upload</td>
<td><input class="image" type='file' size='30' name='upload3'></td>
</tr>
<tr>
<td>Upload</td>
<td><input class="image" type='file' size='30' name='upload4'></td>
</tr>
<tr>
<td>Upload</td>
<td><input class="image" type='file' size='30' name='upload5'></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td>
</tr>
</table>
</form>



</html>

<?php }  

function display_thankyou() {
   global $_values, $_referer;?>
<html>
<p style="margin-top:100px; padding-bottom:300px;"><b>Thank you for your submission</b></p>



</html>

<?php } 
function display_default() { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Successful submission</title><link rel="shortcut icon" href="http://forms-expert.com/images/favicon.ico" /><style>html,body,form,fieldset{margin:0;padding:0}html,body{   height:100%}body{color:#000;background:#FFF;font-family:Tahoma,Arial,Helvetica,sans-serif;line-height:160%}body#bd{padding:0;color:#333;background-color:#FFF}body.fs4{font-size:12px}.componentheading{color:#4F4F4F;font-family:"Segoe UI","Trebuchet MS",Arial,Helvetica,sans-serif;font-weight:bold}small,.small{color:#666;font-size:92%}ul{list-style:none}ul li{padding-left:30px;background:url(../images/bullet-list.gif) no-repeat 18px 9px;line-height:180%}.componentheading{padding:0 0 15px 0;margin-bottom:0px;color:#4F4F4F;background:url(http://forms-expert.com/images/dot.gif) repeat-x bottom;font-size:250%;font-weight:bold}#ja-header{height:60px;position:relative;z-index:999;width:920px;margin:0 auto;clear:both}#ja-containerwrap,#ja-footer{width:920px;margin:0 auto;clear:both}#main-container{ min-height:100%; /*height:100%;*/   position:relative}#ja-footerwrap{clear:both;border-top:1px solid #CCC;margin-top:10px;background:url(../images/grad2.gif) repeat-x top; position:absolute; bottom:0; width:100%; height:60px}#ja-footer{padding:15px 0;position:relative}#ja-footer small{padding:4px 0 0 10px;float:left;display:block;color:#999;font-style:normal;line-height:normal}small.ja-copyright{position:absolute;right:10px}#ja-footer a{color:#666;text-decoration:none}#ja-footer a:hover,#ja-footer a:active,#ja-footer a:focus{color:#666;text-decoration:underline}#ja-footer ul{margin:4px 0 5px 10px;padding:0;float:left;background:url(http://forms-expert.com/images/vline.gif) no-repeat center right;line-height:normal}#ja-footer li{margin:0;padding:0;display:inline;background:none}#ja-footer li a{padding:0 10px;display:inline;background:url(http://forms-expert.com/images/vline.gif) no-repeat center left;font-size:92%;line-height:normal}.clearfix:after{clear:both;display:block;content:".";height:0;visibility:hidden}* html >body .clearfix{width:100%;display:block}* html .clearfix{height:1%}/* Firefox Scrollbar Hack - Do not remove *//*html{margin-bottom:1px;height:100%!important;height:auto}*/a{color:#F90}a:hover,a:active,a:focus{color:#F90}#ja-containerwrap{padding:0;padding-bottom:60px}</style></head><body id="bd" class="fs4"><div id="main-container"><br><br><br><br><br><div id="ja-containerwrap">	<div id="ja-container" class="clearfix"><div style="padding: 20px 30px 20px 30px;"><div class="ja-innerpad clearfix"><div class="componentheading">Your submission was successful. Thank you.</div><p align="right">This form was processed by <a href="http://forms-expert.com">Forms Expert</a>.<p align="right">© 2009 Forms-Expert. </div></div></div></div><div id="ja-footerwrap"><div id="ja-footer" class="clearfix"><ul><li><a href="http://forms-expert.com">Visit Forms Expert</a></li><li><a href="http://forms-expert.com/form-processing-features/">Features</a></li><li><a href="http://forms-expert.com/download/">Download Beta</a></li><li><a href="http://forms-expert.com/support/">Support</a></li><li><a href="http://forms-expert.com/contactus/">Contact page</a></li></ul><small class="ja-copyright">© 2009 <a href="http://forms-expert.com/">Forms-Expert</a></small></div></div></div></body></html> <?php }
function display_spam_warning() { ?> <html>
<form action="" method="post"><style> .form_expert_style {display: none;} </style>
<?php IsThereErrors("1", $_iserrors); ?>
<input type="hidden" name="firstname" value="<?php echo htmlspecialchars($_values['firstname'])?>">
<input type="hidden" name="lastname" value="<?php echo htmlspecialchars($_values['lastname'])?>">
<input type="hidden" name="email" value="<?php echo htmlspecialchars($_values['email'])?>">
<input type="hidden" name="companynumber" value="<?php echo htmlspecialchars($_values['companynumber'])?>">
<input type="hidden" name="upload1" value="<?php echo htmlspecialchars($_values['upload1'])?>">
<input type="hidden" name="upload1_real-name" value="<?php echo htmlspecialchars($_values['upload1_real-name'])?>">
<input type="hidden" name="upload2" value="<?php echo htmlspecialchars($_values['upload2'])?>">
<input type="hidden" name="upload2_real-name" value="<?php echo htmlspecialchars($_values['upload2_real-name'])?>">
<input type="hidden" name="upload3" value="<?php echo htmlspecialchars($_values['upload3'])?>">
<input type="hidden" name="upload3_real-name" value="<?php echo htmlspecialchars($_values['upload3_real-name'])?>">
<input type="hidden" name="upload4" value="<?php echo htmlspecialchars($_values['upload4'])?>">
<input type="hidden" name="upload4_real-name" value="<?php echo htmlspecialchars($_values['upload4_real-name'])?>">
<input type="hidden" name="upload5" value="<?php echo htmlspecialchars($_values['upload5'])?>">
<input type="hidden" name="upload5_real-name" value="<?php echo htmlspecialchars($_values['upload5_real-name'])?>">
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="2">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>
<p align="center"><b>Your submission seems to be a SPAM. Please contact web site administrator or click "Back" button to return to the form.</b></p>
<p align="center"><input type="submit" name="back" value="< Back"></p></form>



</html>
<?php }
  function BuildBody($body, $html, $num){
   global $zag, $un;
   if ($html) {
       	  $zag[$num]       = "--".$un."\r\nContent-Type:text/html;\r\n";
       }
    else {
           $zag[$num]       = "--".$un."\r\nContent-Type:text/plain;\r\n";
     };
       $zag[$num]      .= "Content-Transfer-Encoding: 8bit\r\n\r\n$body\r\n\r\n";
  }
  function SendEmails (){
    global $_values, $zag, $un;
    $un        = strtoupper(uniqid(time()));
    $to[0] .= htmlspecialchars($_values["companynumber"]) . "@aissolutions.ca";
    $from[0]      .= "".str_replace("%,%", ",", $_values['email'])."";
    $subject[0]      .= "upload_form was submitted on ".date("F j, Y")." ".date("H:i")."";
    $head[0]     .= "MIME-Version: 1.0\r\n";
    $head[0]      .= "From: ".str_replace("%,%", ",", $_values['email'])."\r\n";
    $head[0]     .= "X-Mailer: Forms Expert at www.forms-expert.com\r\n";
    $head[0]      .= "Reply-To: ".str_replace("%,%", ",", $_values['email'])."\r\n";
    $head[0]     .= "Content-Type:multipart/mixed;";
    $head[0]     .= "boundary=\"".$un."\"\r\n\r\n";
    $EmailBody = "<html><body>
Form was filled with the following data:
<br><b>firstname:</b> ".htmlspecialchars($_values["firstname"])."
<br><b>lastname:</b> ".htmlspecialchars($_values["lastname"])."
<br><b>email:</b> ".htmlspecialchars($_values["email"])."
<br><b>companynumber:</b> ".htmlspecialchars($_values["companynumber"])."
<br><b>upload1:</b> ".htmlspecialchars($_values["upload1"])."
<br><b>upload2:</b> ".htmlspecialchars($_values["upload2"])."
<br><b>upload3:</b> ".htmlspecialchars($_values["upload3"])."
<br><b>upload4:</b> ".htmlspecialchars($_values["upload4"])."
<br><b>upload5:</b> ".htmlspecialchars($_values["upload5"])."
</body></html>
";
    BuildBody($EmailBody, True, 0);
    for ($i=0;$i<=0;$i++){
      mail($to[$i], $subject[$i], $zag[$i], $head[$i]);
    }
  }

$actions = array ("display_page_upload_form","display_thankyou");

session_start();
if(!isset($_SESSION["FormSent"])) {
  $_SESSION["FormSent"] = time();
  $delta = -1;
} else {
  $delta = time() - $_SESSION["FormSent"];
}

if (((strlen(trim(@$_POST["URL"])) > 0) or (($delta>-1)and($delta<2)))and(!isset($_POST["back"]))){
   display_spam_warning();
}else{
unset($_SESSION["FormSent"]);

if (in_array($_GET["image"], array("warning"))) {
	header("Content-type: image/png");
	echo base64_decode("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUisiGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQsf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJOyhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCN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OohBiCbERhmzKzvGDycdBkcXOIYOP+cY/j36T3Db6C+/6BcBso5/yBR9f8vJGr+Qdl/f/1j+HrvNoOquhrbk9vcqUBVRwECiIWZjV36x6PXDN/+fmX4D7QAhJnYIJYxMUEiiRFU2AEx039YjvnHwPRxPwMX435gOQG1ENpnAKljAOL/oMgF8YHmgNT8h2bPL08+MrAAKywuPhYzkBaAAGL59vnVqSf3GBgUBYFFOjcjAzMnE7CEA1oGrAaYWBnBIQDyNZhmRDgI0q2BOIqJAWIZsPQB0/+hoQELgb8//0NyE9Alv7//Y7h/7gnD67cMm0FGAAQQi0VQ2frbpzZOPn37Rryk6H8+7l8sDGzfmBmYQaHAxAi2HGQRjIZ3qRiRa0/UnhM4KmA0KE39/sfw6/t/hl8f/zA8fwrMrFKqS0z9/dtAygECiBFUBnx4cZvh8/tnGoyMzLJAO7mAQc8G8TuSlaT0YRlRa3dgsfwXaM0vYFQB8Z8XvIJSVwQl1UBlKgNAADHiaTwyYRhFHviPhDEAQACx4HA7I5UsZ8BiDopDAAIMAP+QrU5p/QTlAAAAAElFTkSuQmCC");
}else{
	if (isset($_POST["_next_page"])) {
		$_next_page = $_POST["_next_page"];
	}else $_next_page = 0;

	if (isset($_POST["back"])) {
		call_user_func($actions[$_next_page-2],false);
	}else
		if (IsThereErrors($_next_page-1, false)){
			call_user_func($actions[$_next_page-1],true);
		}else {
			call_user_func($actions[$_next_page+0],false);
			if ($_next_page == count($actions)-1) {
				SendEmails();
				session_destroy();
			}
		}
	}
  }
?>

Link to comment
Share on other sites

This might work. You'll still need to pass the form data back though to the other fields though.

 

$upload_quant = 4
if(isset($_POST['increase_upload']))
{
$upload_quant = $_POST['previous_upload'] + 1;
}


for($i=0;$i<$upload_quant;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
echo <<<_END
<tr>
<td>Upload</td>
<td><input class="image" type='file' size='30' name='$upload_name'></td>
</tr>
_END;
}

echo <<<_END
<input type="hidden" value="$upload_quant" name = "previous_upload"/>
<input type="submit" name="increase_upload" value="Add another upload box" />
_END;

 

Otherwise i'm sure you could do this with javascript

Link to comment
Share on other sites

Is the page all your creation or are you adding to it?

 

What i meant earlier was, if the user has entered info into the form before clicking add new upload box. If you are just using php on one html page, then the page will need to be reloaded, this will revert all the form fields back to their default values. Therefore catching them all when the add upload box has been requested means you can input them in again.

Link to comment
Share on other sites

The page is my creation. The upload form works great, but I just don't want to have 20 separate upload fields on the page at once. I would really like to integrate this into it: http://www.maheshchari.com/multifile-upload/ which allows you to click "add another" and then another "file upload" field is displayed, but I don't know if I can integrate this Javascript solution into my current PHP form because how can you tell the submit button to do 2 different form actions at once? This is from my current PHP code:

<form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);">

AND this is part of what I would have to integrate:

<form action="uploader.php" method="post" enctype="multipart/form-data" name="mutiple_file_upload_form" id="mutiple_file_upload_form">

How are you supposed to tell the submit button to do both form actions??

Link to comment
Share on other sites

Have each submit button with its own unique name. Then tell the php to do one thing with one button and one with another.

 

Here is a really basic version of what i meant. If you save this as exaple.php file and put it onto your server you'll be able to test it. Notice if you enter a name into the forename or surname it remains. You could do something similar with the upload boxes

 

<?php
//this is a really basic version of what i meant
//the form sends to its self.

//deafult number of upload boxes
$upload_quant = 4;
//if the user increased the number of boxes
if(isset($_POST['increase_upload']))
{
	//sending the enetered fornames back to the form
	$forename = $_POST['forename'];
	$surname = $_POST['surname'];
	//increasing the number of upload boxes
	$upload_quant = $_POST['previous_upload'] + 1;
}
//if the user send the entire form
elseif(isset($_POST['upload']))
{
	$forename = $_POST['forename'];
	$surname = $_POST['surname'];
	//getting the number of boxes sent
	$upload_quantity = $_POST['previous_upload'];
	//getting all the names into an array
	$uplaoded_array = array();
	for($i=0;$i<$upload_quantity;++$i)
	{
		$ii = $i+1;
		$upload_name = 'upload'.$ii;
		$get_upload_name = $_POST['$upload_name'];
		array_push($uplaoded_array,$get_upload_name);
	}
	//now you have all the info from the form
	//you can now do want you want with it, if you need to send the info to a seperate php use a header
}

echo <<<_END
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>example</title>
</head>

<body>
<form action="example.php" method="post">
<table border="1">
<tr>
	<td>
		First Name *
	<td>
		<input type="text" name="forename" value="$forename"/>
	</td>
</tr>
<tr>
	<td>
		Surname *
	</td>
	<td>
		<input type="text" name="surname" value="$surname"/>
	</td>
</tr>
_END;
for($i=0;$i<$upload_quant;++$i)
{
	$ii = $i+1;
	$upload_name = 'upload'.$ii;
echo <<<_END
<tr>
	<td>Upload $ii</td>
	<td><input class="image" type='file' size='30' name='$upload_name'></td>
</tr>
_END;
}
echo <<<_END
<tr>
	<td>
		<input type="hidden" value="$upload_quant" name = "previous_upload"/>
		<input type="submit" name="increase_upload" value="Add another upload box" />
	</td>
	<td>
		<input type="submit" name="upload" value="Upload everything"/>
	</td>
</tr>
</table>
</form>
</body>
</html>
_END;
?>

Link to comment
Share on other sites

Dude, that is awesome! That is exactly what I am looking for. I tried to integrate this into my "existing" PHP script, but I can't seem to get it right. Is there any way you could show me how to put this solution into the existing script that I posted at the start of this thread? I really appreciate the help!!

Link to comment
Share on other sites

Integrating that dynamic "add an upload field" code (http://www.maheshchari.com/multifile-upload/) does not involve submitting two different forms or having more than one submit button... The action="..." attribute is simply the page that the form submits to and you would use your page name, not the arbitrary name that was used in the demo code.

 

Whatever method you end up using, please use an array as the name="..." attribute (like the multifile-upload code is doing, i.e. name="images[]") so that you can simply loop over the uploaded files to process them.

Link to comment
Share on other sites

Okay, this is how I tried integrating it into my current form:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/secondary.dwt" codeOutsideHTMLIsLocked="false" -->

<head>
<!-- InstanceBeginEditable name="Head" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File Upload - AIS Solutions</title>
<meta name="description" content="Here is all of the contact information for AIS Solutions in Burlington, Ontario."/>
<link href="include/global.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17937129-3']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<!-- InstanceEndEditable -->
</head>

<body>
<center>
<!-- Top Start -->
<div class="top">
<div class="logo"><img src="images/logo.jpg" alt="AIS Solutions"/></div>
    <div class="contact">
    	<b>
         Call Toll Free 1.888.575.5385
       </b>
    </div>

</div>
<!-- Top End -->
<div class="wrapper">
<!-- Flash Start -->
<div class="flash">
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="848" height="180" id="home" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="home.swf" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />	<embed src="home.swf" quality="best" wmode="transparent" bgcolor="#ffffff" width="848" height="180" name="home" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
    </div>
<!-- Flash End --> 
<!-- Navigation Start -->
<div class="nav" id="navigation">
   <ul id="navbar">
    	<li><a href="home.html" class="nlink">HOME</a>
      
        </li>
        <li><a href="" class="nlink">WHAT WE DO</a>
        	<ul>
          	<li class="drop"><a href="services_for_business.html">Our Solutions</a></li>
          	<li class="drop"><a href="bookkeeping_services.html">Bookkeeping Solutions</a></li>
            <li class="drop"><a href="accounting_services.html">Accounting Solutions</a></li>
            <li class="drop"><a href="web_design_services.html">Web Design Solutions</a></li>
            <li class="drop"><a href="web_marketing_services.html">Web Marketing Solutions</a></li>
   		  </ul>
        </li>
        <li><a href="#" class="nlink">WHY CHOOSE US</a>
        	<ul>
          	<li class="drop"><a href="benefits_of_outsourcing.html">Benefits of Outsourcing</a></li>
          	<li class="drop"><a href="our_clients_speak.html">Our Clients Speak</a></li>
            <li class="drop"><a href="Resources_for_Business.html">Resources</a></li>
   		  </ul>
        </li>
        <li><a href="#" class="nlink">HOW WE DO IT</a>
        	<ul>
          	<li class="drop"><a href="your_business_partner.html">Become Your Partner</a></li>
          	<li class="drop"><a href="our_guarantee.html">Guaranteed Results</a></li>
            <li class="drop"><a href="our_pricing.html">Affordable Pricing</a></li>
   		  </ul>
        </li>
        <li><a href="" class="nlink">WHO WE ARE</a>
        	<ul>
          	<li class="drop"><a href="about_us.html">Our Beginning</a></li>
            <li class="drop"><a href="our_team.html">Our Team</a></li>
          	<li class="drop"><a href="join_our_team.html">Join Us</a></li>
            <li class="drop"><a href="contact.html">Contact</a></li>
   		  </ul>
        </li>
        <li><a href="http://www.aissolutions.ca/blog/" class="nlink">BLOG</a></li>
    </ul>
    </div>
<!-- Navigation End -->
<!-- Content Start -->
<div class="info">
    	<div class="right-top">
        	Latest News
        </div>
        Welcome to the New Website for AIS Solutions!  We have a new look and expanded range of <a href="services_for_business.html">services</a>, but have the same <a href="our_team.html">team</a> of professionals that you have come to depend on over the years. <img src="images/info-bottom.gif" alt="bottom" class="info-img"/><br />
    </div>
    <div class="info">
    	<div class="right-top">
        	Our Clients Speak
        </div>
        “The AIS team has a broad set of practical business operation experiences which they are able to harness in supporting your firm in an efficient, effective and customized manner.”<br/>
        <a href="our_clients_speak.html">Read Our Testimonials </a><img src="images/info-bottom.gif" alt="bottom" class="info-img"/><br />
    </div>
<a href="consultation.php" class="consultation"><img src="images/consultation-button.png" alt="Click here for a Free Consultation"/></a>
    <div class="secondary">
    <!-- InstanceBeginEditable name="Secondary-Content" -->
    	<div> <h1 class="grey-title">File Upload</h1>
   <p class="filesize"><span>NOTE:</span> You may upload 1-5 files at a time. Total upload size limit is 20MB. If you need to send a file which is greater than 20MB, please <a href="mailto:info@aissolutions.ca">contact us.</a><br /><br />
        **When uploading a large file or multiple files, please be patient and wait for the "Thank you for your submission" text to appear on the screen before you leave the page**</p>
        <br /><br />
         <?php error_reporting(0);

foreach($_POST as $key => $value){
    	if (is_array($value)) {
    		$_values[$key] = join("%,% ",$value);
    	}else $_values[$key] = $value;
      $_values[$key]=stripslashes($_values[$key]);
      }

if (!isset($_POST["_referer"])) {
	@$_referer = $_SERVER["HTTP_REFERER"];
}else $_referer = $_POST["_referer"];


$_ErrorList = array();

function mark_if_error($_field_name, $_old_style = ""){
global $_ErrorList;
	$flag=false;
	foreach($_ErrorList as $_error_item_name){
		if ($_error_item_name==$_field_name) {
			$flag=true;
		}
}
echo $flag ? "style=\"background-color: #FFCCBA; border: solid 1px #D63301;\"" : $_old_style;
}

function IsThereErrors($form, $_isdisplay) {
  global $_POST, $_FILES, $_values, $_ErrorList;
  $flag = false;
  if ($form > -1) {
  if ($_isdisplay) {
  	echo "<div style=\"border: 1px solid; margin: 10px auto; padding:15px 10px 15px 50px; background-repeat: no-repeat; background-position: 10px center; color: #D63301; background-color: #FFCCBA; max-width:600px; background-image:url('".$_SERVER["PHP_SELF"]."?image=warning');\">";
  }

  $flag = false;

  $req[0][] =  array("firstname", "firstname is required.");
  $req[0][] =  array("lastname", "lastname is required.");
  $req[0][] =  array("email", "email is required.");
  $req[0][] =  array("companynumber", "companynumber is required.");
  foreach($req[$form] as $field){
    if (!isset($_values[$field[0]]) or ($_values[$field[0]]=="")) {
      $flag = true;
      if ($_isdisplay) {
      	echo $field[1]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

  $files_req[0][] =  array("upload1", "upload1 is required.");
  foreach($files_req[$form] as $field){
    if (@$_FILES[$field[0]]["name"]=="") {
      $flag = true;
      if ($_isdisplay) {
      	echo $field[1]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

  $fields[0][] = array("email", '/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/', true, "email should be valid e-mail address.");
  $fields[0][] = array("companynumber", '/^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/', true, "companynumber should contain integer or floating point value only.");
  foreach($fields[$form] as $field){
    if (!(preg_match($field[1],$_values[$field[0]])==$field[2]) && $_values[$field[0]]!=""){
      $flag = true;
      if ($_isdisplay) {
      	echo $field[3]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

	  $files[0][] = array("upload1", "true", "true", "You are trying to upload file with not allowed extension.", "true", "");
	  $files[0][] = array("upload2", "true", "true", "", "true", "");
	  $files[0][] = array("upload3", "true", "true", "", "true", "");
	  $files[0][] = array("upload4", "true", "true", "", "true", "");
	  $files[0][] = array("upload5", "true", "true", "", "true", "");
	  foreach($files[$form] as $file){
     $str = $file[1];
     if (eval("if($str){return true;}")) {
        $_values[$file[0]] = $_FILES[$file[0]]["name"];
        $dirs = explode("/","attachments//");
        $cur_dir =".";
        foreach($dirs as $dir){
        $cur_dir = $cur_dir."/".$dir;
        if (!@opendir($cur_dir)) { mkdir($cur_dir, 0777);}}
        $_values[$file[0]."_real-name"] = "attachments/".date("YmdHis")."_".$_FILES[$file[0]]["name"]."_secure";
        copy($_FILES[$file[0]]["tmp_name"],$_values[$file[0]."_real-name"]);
        @unlink($_FILES[$file[0]]["tmp_name"]);
     }else{
      $flag=true;
      if ($_isdisplay) {
      	//$ExtFltr = $file[2];
      	//$FileSize = $file[4];
        if (!eval("if($file[2]){return true;}")){echo $file[3];}
        if (!eval("if($file[4]){return true;}")){echo $file[5];}
      	$_ErrorList[] = $file[0];
      }
     }
  }

  if ($_isdisplay) {
  	echo "</div>";
  }
  }
  return $flag;
}


function display_page_upload_form($_iserrors) {
   global $_values, $_referer;?>
<html><SCRIPT LANGUAGE = "JavaScript">
var fields = {
"companynumber" : ["companynumber", /^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/, true, "Your Company Number should be entered with no spaces or hyphens."],
"email" : ["email", /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/, true, "Please ensure your email address is in a valid format."]
};
var req = {
"upload1" : ["upload1", "upload1 is required."],
"companynumber" : ["companynumber", "company number is required."],
"email" : ["email", "email is required."],
"lastname" : ["lastname", "last name is required."],
"firstname" : ["firstname", "first name is required."]
};
var validate_form = true;function CheckForm(){HideAllErrors();if(!validate_form)return true;var LastErrorField=null;for(var i in fields){isError=ValidateField(fields[i][0],fields[i][1],fields[i][2],fields[i][3]);if(isError)LastErrorField=isError}for(var i in req){isError=isFilled(req[i][0],req[i][1]);if(isError)LastErrorField=isError}if(LastErrorField){LastErrorField.focus();return false}else return true}function ShowTooltip(type,field,message){var IE='\v'=='v';var container;if(!(container=document.getElementById('error_list'))){var container=(IE)?(document.createElement('<div name="error_list">')):(document.createElement('div'));container=document.createElement('div');container.setAttribute('id','error_list');document.body.appendChild(container)}if(!document.getElementById(field+'_tooltip')){var elem=(IE)?(document.createElement('<div name="myName">')):(document.createElement('div'));var elem2=(IE)?(document.createElement('<div name="myName2">')):(document.createElement('div'));div_id=field+'_tooltip';elem=document.createElement('div');elem.setAttribute('id',div_id);elem.className="fe-"+type+"-container";elem.onmouseover=function(){MoveDivToTop(this)};elem.onclick=function(){HideTooltip(this.id)};elem2=document.createElement('div');elem2.className="fe-"+type;elem2.innerHTML=message;parentField=document.getElementsByName(field);var f=0;while(parentField[f].type=='hidden')f++;with(elem.style){top=findPos(parentField[f])[0]+'px';left=findPos(parentField[f])[1]+parentField[f].offsetWidth+'px'}elem.appendChild(elem2);container.appendChild(elem)}}function ValidateField(name,rule,condition,message){fld=document.getElementsByName(name);var i=0;while(fld[i].type=='hidden')i++;if(!(((fld[i].value.match(rule)!=null)==condition)||(fld[i].value==""))){ShowTooltip('error',fld[i].name,message);return fld[i]}return null}function isFilled(name,message){fld=document.getElementsByName(name);var isFilled=false;var i=0;while(fld[i].type=='hidden')i++;var obj=fld[i];for(j=i;j<fld.length;j++){if((fld[j].type=='checkbox')||(fld[j].type=='radio')){if(fld[j].checked)isFilled=true}else{if(fld[j].value!="")isFilled=true}}if(isFilled){return null}else{ShowTooltip('error',name,message);return obj}}function FieldBlur(elemId){HideTooltip(elemId);fieldName=elemId.replace(/(\S{0,})_tooltip/,"$1");if(typeof fields[fieldName]!='undefined'){ValidateField(fields[fieldName][0],fields[fieldName][1],fields[fieldName][2],fields[fieldName][3])}if(typeof req[fieldName]!='undefined'){isFilled(req[fieldName][0],req[fieldName][1])}}function HideTooltip(elemId){var elem=document.getElementById(elemId);var parent=document.getElementById('error_list');if((elem)&&(parent))parent.removeChild(elem)}function HideAllErrors(){error_container=document.getElementById('error_list');if(error_container!=null){while(error_container.childNodes.length>0){error_container.removeChild(error_container.firstChild)}}}function MoveDivToTop(div_to_top){div_container=document.getElementById('error_list');for(i=0;i<div_container.childNodes.length;i++)div_container.childNodes[i].style.zIndex="998";div_to_top.style.zIndex="999"}function findPos(obj){var curleft=curtop=0;do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent);return[curtop,curleft]}
</SCRIPT>
<style type="text/css"> .form_expert_style {display: none;}.fe-info,.fe-error{font:13px arial,helvetica,verdana,sans-serif;padding:2px;position:relative;top:-7px}.fe-error{border:solid 1px #d51007;background:#fbe3e4;color:#d51007}.fe-info{border:solid 1px #0187c5;background:#eff9ff;color:#0187c5}.fe-info-container,.fe-error-container{position:absolute;padding:0;border-left:8px solid transparent;-border-left:8px solid white;filter:progid:DXImageTransform.Microsoft.Chroma(color="white")}.fe-error-container{border-top:8px solid #d00}.fe-info-container{border-top:8px solid #0187c5} </style>

<?php
//this is a really basic version of what i meant
//the form sends to its self.

//deafult number of upload boxes
$upload_quant = 4;
//if the user increased the number of boxes
if(isset($_POST['increase_upload']))
{
//sending the enetered fornames back to the form
$forename = $_POST['firstname'];
$surname = $_POST['lastname'];
//increasing the number of upload boxes
$upload_quant = $_POST['previous_upload'] + 1;
}
//if the user send the entire form
elseif(isset($_POST['upload']))
{
$forename = $_POST['firstname'];
$surname = $_POST['lastname'];
//getting the number of boxes sent
$upload_quantity = $_POST['previous_upload'];
//getting all the names into an array
$uplaoded_array = array();
for($i=0;$i<$upload_quantity;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
$get_upload_name = $_POST['$upload_name'];
array_push($uplaoded_array,$get_upload_name);
}
//now you have all the info from the form
//you can now do want you want with it, if you need to send the info to a seperate php use a header
}
echo <<<_END ?>

<form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);">
<?php IsThereErrors("0", $_iserrors); ?>
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="1">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>

<table>
<tr>
<td>First Name *</td>
<td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td>
</tr>
<tr>
<td>Last Name *</td>
<td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td>
</tr>
<tr>
<td>E-mail *</td>
<td><input type='text' size='30' name='email'  onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td>
</tr>
<tr>
<td>Company Number *</td>
<td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td>
</tr> 
for($i=0;$i<$upload_quant;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
echo <<<_END
<tr>
<td>Upload $ii</td>
<td><input class="image" type='file' size='30' name='$upload_name'></td>
</tr>
_END;
}
echo <<<_END
<tr>
<td>
<input type="hidden" value="$upload_quant" name = "previous_upload"/>
<input type="submit" name="increase_upload" value="Add another upload box" />
</td>
<tr>
<td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td>
</tr>
</table>
</form>

</html>

<?php }  

function display_thankyou() {
   global $_values, $_referer;?>
<html>
<p style="margin-top:100px; padding-bottom:300px;"><b>Thank you for your submission</b></p>



</html>

<?php } 
function display_default() { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Successful submission</title><link rel="shortcut icon" href="http://forms-expert.com/images/favicon.ico" /><style>html,body,form,fieldset{margin:0;padding:0}html,body{   height:100%}body{color:#000;background:#FFF;font-family:Tahoma,Arial,Helvetica,sans-serif;line-height:160%}body#bd{padding:0;color:#333;background-color:#FFF}body.fs4{font-size:12px}.componentheading{color:#4F4F4F;font-family:"Segoe UI","Trebuchet MS",Arial,Helvetica,sans-serif;font-weight:bold}small,.small{color:#666;font-size:92%}ul{list-style:none}ul li{padding-left:30px;background:url(../images/bullet-list.gif) no-repeat 18px 9px;line-height:180%}.componentheading{padding:0 0 15px 0;margin-bottom:0px;color:#4F4F4F;background:url(http://forms-expert.com/images/dot.gif) repeat-x bottom;font-size:250%;font-weight:bold}#ja-header{height:60px;position:relative;z-index:999;width:920px;margin:0 auto;clear:both}#ja-containerwrap,#ja-footer{width:920px;margin:0 auto;clear:both}#main-container{ min-height:100%; /*height:100%;*/   position:relative}#ja-footerwrap{clear:both;border-top:1px solid #CCC;margin-top:10px;background:url(../images/grad2.gif) repeat-x top; position:absolute; bottom:0; width:100%; height:60px}#ja-footer{padding:15px 0;position:relative}#ja-footer small{padding:4px 0 0 10px;float:left;display:block;color:#999;font-style:normal;line-height:normal}small.ja-copyright{position:absolute;right:10px}#ja-footer a{color:#666;text-decoration:none}#ja-footer a:hover,#ja-footer a:active,#ja-footer a:focus{color:#666;text-decoration:underline}#ja-footer ul{margin:4px 0 5px 10px;padding:0;float:left;background:url(http://forms-expert.com/images/vline.gif) no-repeat center right;line-height:normal}#ja-footer li{margin:0;padding:0;display:inline;background:none}#ja-footer li a{padding:0 10px;display:inline;background:url(http://forms-expert.com/images/vline.gif) no-repeat center left;font-size:92%;line-height:normal}.clearfix:after{clear:both;display:block;content:".";height:0;visibility:hidden}* html >body .clearfix{width:100%;display:block}* html .clearfix{height:1%}/* Firefox Scrollbar Hack - Do not remove *//*html{margin-bottom:1px;height:100%!important;height:auto}*/a{color:#F90}a:hover,a:active,a:focus{color:#F90}#ja-containerwrap{padding:0;padding-bottom:60px}</style></head><body id="bd" class="fs4"><div id="main-container"><br><br><br><br><br><div id="ja-containerwrap">	<div id="ja-container" class="clearfix"><div style="padding: 20px 30px 20px 30px;"><div class="ja-innerpad clearfix"><div class="componentheading">Your submission was successful. Thank you.</div><p align="right">This form was processed by <a href="http://forms-expert.com">Forms Expert</a>.<p align="right">© 2009 Forms-Expert. </div></div></div></div><div id="ja-footerwrap"><div id="ja-footer" class="clearfix"><ul><li><a href="http://forms-expert.com">Visit Forms Expert</a></li><li><a href="http://forms-expert.com/form-processing-features/">Features</a></li><li><a href="http://forms-expert.com/download/">Download Beta</a></li><li><a href="http://forms-expert.com/support/">Support</a></li><li><a href="http://forms-expert.com/contactus/">Contact page</a></li></ul><small class="ja-copyright">© 2009 <a href="http://forms-expert.com/">Forms-Expert</a></small></div></div></div></body></html> <?php }
function display_spam_warning() { ?> <html>
<form action="" method="post"><style> .form_expert_style {display: none;} </style>
<?php IsThereErrors("1", $_iserrors); ?>
<input type="hidden" name="firstname" value="<?php echo htmlspecialchars($_values['firstname'])?>">
<input type="hidden" name="lastname" value="<?php echo htmlspecialchars($_values['lastname'])?>">
<input type="hidden" name="email" value="<?php echo htmlspecialchars($_values['email'])?>">
<input type="hidden" name="companynumber" value="<?php echo htmlspecialchars($_values['companynumber'])?>">
<input type="hidden" name="upload1" value="<?php echo htmlspecialchars($_values['upload1'])?>">
<input type="hidden" name="upload1_real-name" value="<?php echo htmlspecialchars($_values['upload1_real-name'])?>">
<input type="hidden" name="upload2" value="<?php echo htmlspecialchars($_values['upload2'])?>">
<input type="hidden" name="upload2_real-name" value="<?php echo htmlspecialchars($_values['upload2_real-name'])?>">
<input type="hidden" name="upload3" value="<?php echo htmlspecialchars($_values['upload3'])?>">
<input type="hidden" name="upload3_real-name" value="<?php echo htmlspecialchars($_values['upload3_real-name'])?>">
<input type="hidden" name="upload4" value="<?php echo htmlspecialchars($_values['upload4'])?>">
<input type="hidden" name="upload4_real-name" value="<?php echo htmlspecialchars($_values['upload4_real-name'])?>">
<input type="hidden" name="upload5" value="<?php echo htmlspecialchars($_values['upload5'])?>">
<input type="hidden" name="upload5_real-name" value="<?php echo htmlspecialchars($_values['upload5_real-name'])?>">
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="2">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>
<p align="center"><b>Your submission seems to be a SPAM. Please contact web site administrator or click "Back" button to return to the form.</b></p>
<p align="center"><input type="submit" name="back" value="< Back"></p></form>



</html>
<?php }
  function BuildBody($body, $html, $num){
   global $zag, $un;
   if ($html) {
       	  $zag[$num]       = "--".$un."\r\nContent-Type:text/html;\r\n";
       }
    else {
           $zag[$num]       = "--".$un."\r\nContent-Type:text/plain;\r\n";
     };
       $zag[$num]      .= "Content-Transfer-Encoding: 8bit\r\n\r\n$body\r\n\r\n";
  }
  function SendEmails (){
    global $_values, $zag, $un;
    $un        = strtoupper(uniqid(time()));
    $to[0] .= htmlspecialchars($_values["companynumber"]) . "@aissolutions.ca";
    $from[0]      .= "".str_replace("%,%", ",", $_values['email'])."";
    $subject[0]      .= "upload_form was submitted on ".date("F j, Y")." ".date("H:i")."";
    $head[0]     .= "MIME-Version: 1.0\r\n";
    $head[0]      .= "From: ".str_replace("%,%", ",", $_values['email'])."\r\n";
    $head[0]     .= "X-Mailer: Forms Expert at www.forms-expert.com\r\n";
    $head[0]      .= "Reply-To: ".str_replace("%,%", ",", $_values['email'])."\r\n";
    $head[0]     .= "Content-Type:multipart/mixed;";
    $head[0]     .= "boundary=\"".$un."\"\r\n\r\n";
    $EmailBody = "<html><body>
Form was filled with the following data:
<br><b>firstname:</b> ".htmlspecialchars($_values["firstname"])."
<br><b>lastname:</b> ".htmlspecialchars($_values["lastname"])."
<br><b>email:</b> ".htmlspecialchars($_values["email"])."
<br><b>companynumber:</b> ".htmlspecialchars($_values["companynumber"])."
<br><b>upload1:</b> ".htmlspecialchars($_values["upload1"])."
<br><b>upload2:</b> ".htmlspecialchars($_values["upload2"])."
<br><b>upload3:</b> ".htmlspecialchars($_values["upload3"])."
<br><b>upload4:</b> ".htmlspecialchars($_values["upload4"])."
<br><b>upload5:</b> ".htmlspecialchars($_values["upload5"])."
</body></html>
";
    BuildBody($EmailBody, True, 0);
    for ($i=0;$i<=0;$i++){
      mail($to[$i], $subject[$i], $zag[$i], $head[$i]);
    }
  }

$actions = array ("display_page_upload_form","display_thankyou");

session_start();
if(!isset($_SESSION["FormSent"])) {
  $_SESSION["FormSent"] = time();
  $delta = -1;
} else {
  $delta = time() - $_SESSION["FormSent"];
}

if (((strlen(trim(@$_POST["URL"])) > 0) or (($delta>-1)and($delta<2)))and(!isset($_POST["back"]))){
   display_spam_warning();
}else{
unset($_SESSION["FormSent"]);

if (in_array($_GET["image"], array("warning"))) {
	header("Content-type: image/png");
	echo base64_decode("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUisiGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQsf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJOyhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaIb4tYM0mYzBXxW3FsMoeZDgCKJLYLOKx4EZuImMQPDnQR8XIAcKS4LzjmCxZwsgTiQ7mkpGbzuXHxArouS49uam3NoHtyMpM4AoGhP5OVyOSz6S4pyalMXjYAi2f+LBlxbemiIluaWltaGpoZmX5RqP+6+Dcl7u0ivQr43DOI1veH7a/8UuoAYMyKarPrD1vMfgA6tgIgd/8Pm+YhACRFfWu/8cV5aOJ5iRcIUm2MjTMzM424HJaRuKC/6386/A198T0j8Xa/l4fuyollCpMEdHHdWClJKUI+PT2VyeLQDf88xP848K/zWBrIieXwOTxRRKhoyri8OFG7eWyugJvCo3N5/6mJ/zDsT1qca5Eo9Z8ANcoISN2gAuTnPoCiEAESeVDc9d/75oMPBeKbF6Y6sTj3nwX9+65wifiRzo37HOcSGExnCfkZi2viawnQgAAkARXIAxWgAXSBITADVsAWOAI3sAL4gWAQDtYCFogHyYAPMkEu2AwKQBHYBfaCSlAD6kEjaAEnQAc4DS6Ay+A6uAnugAdgBIyD52AGvAHzEARhITJEgeQhVUgLMoDMIAZkD7lBPlAgFA5FQ3EQ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	if (isset($_POST["_next_page"])) {
		$_next_page = $_POST["_next_page"];
	}else $_next_page = 0;

	if (isset($_POST["back"])) {
		call_user_func($actions[$_next_page-2],false);
	}else
		if (IsThereErrors($_next_page-1, false)){
			call_user_func($actions[$_next_page-1],true);
		}else {
			call_user_func($actions[$_next_page+0],false);
			if ($_next_page == count($actions)-1) {
				SendEmails();
				session_destroy();
			}
		}
	}
  }
?>
   </div>    
    <!-- InstanceEndEditable -->
</div>
    <img src="images/secondary-bottom.png" alt="bottom" class="stop"/>
<!-- Content End -->
</div>
<!-- Bottom Start -->
<div class="bottom">
<div class="contact2">
        Phone: 905.333.9637 | Toll Free 1.888.575.5385<br />
        Email: <a href="mailto:info@aissolutions.ca" class="clink">info@aissolutions.ca</a>
        <br /><br />
        <a href="#" class="clink">SITEMAP</a> | <a href="privacy_policy.html" class="clink">PRIVACY POLICY</a> | <a href="contact.html" class="clink">CONTACT</a>
    </div>
                 Customer Satisfaction is the cornerstone of our business.<br />
                    We believe so strongly in our  services that we give you<br />
                     a "Money Back" limited guarantee. <br/>
    <strong>                 Call now and ask    for details.  1-888-575-5385</strong><br />
</div>
<!-- Bottom End -->
</center></body>
<!-- InstanceEnd --></html>

 

I get this error: Parse error: syntax error, unexpected T_SL in /home/freewe8/public_html/formtest/upload.php on line 275

 

Thanks.

Link to comment
Share on other sites

So, I tried it this way now:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/secondary.dwt" codeOutsideHTMLIsLocked="false" -->

<head>
<!-- InstanceBeginEditable name="Head" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File Upload - AIS Solutions</title>
<meta name="description" content="Here is all of the contact information for AIS Solutions in Burlington, Ontario."/>
<link href="include/global.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17937129-3']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<!-- InstanceEndEditable -->
</head>

<body>
<center>
<!-- Top Start -->
<div class="top">
<div class="logo"><img src="images/logo.jpg" alt="AIS Solutions"/></div>
    <div class="contact">
    	<b>
         Call Toll Free 1.888.575.5385
       </b>
    </div>

</div>
<!-- Top End -->
<div class="wrapper">
<!-- Flash Start -->
<div class="flash">
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="848" height="180" id="home" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="home.swf" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />	<embed src="home.swf" quality="best" wmode="transparent" bgcolor="#ffffff" width="848" height="180" name="home" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
    </div>
<!-- Flash End --> 
<!-- Navigation Start -->
<div class="nav" id="navigation">
   <ul id="navbar">
    	<li><a href="home.html" class="nlink">HOME</a>
      
        </li>
        <li><a href="" class="nlink">WHAT WE DO</a>
        	<ul>
          	<li class="drop"><a href="services_for_business.html">Our Solutions</a></li>
          	<li class="drop"><a href="bookkeeping_services.html">Bookkeeping Solutions</a></li>
            <li class="drop"><a href="accounting_services.html">Accounting Solutions</a></li>
            <li class="drop"><a href="web_design_services.html">Web Design Solutions</a></li>
            <li class="drop"><a href="web_marketing_services.html">Web Marketing Solutions</a></li>
   		  </ul>
        </li>
        <li><a href="#" class="nlink">WHY CHOOSE US</a>
        	<ul>
          	<li class="drop"><a href="benefits_of_outsourcing.html">Benefits of Outsourcing</a></li>
          	<li class="drop"><a href="our_clients_speak.html">Our Clients Speak</a></li>
            <li class="drop"><a href="Resources_for_Business.html">Resources</a></li>
   		  </ul>
        </li>
        <li><a href="#" class="nlink">HOW WE DO IT</a>
        	<ul>
          	<li class="drop"><a href="your_business_partner.html">Become Your Partner</a></li>
          	<li class="drop"><a href="our_guarantee.html">Guaranteed Results</a></li>
            <li class="drop"><a href="our_pricing.html">Affordable Pricing</a></li>
   		  </ul>
        </li>
        <li><a href="" class="nlink">WHO WE ARE</a>
        	<ul>
          	<li class="drop"><a href="about_us.html">Our Beginning</a></li>
            <li class="drop"><a href="our_team.html">Our Team</a></li>
          	<li class="drop"><a href="join_our_team.html">Join Us</a></li>
            <li class="drop"><a href="contact.html">Contact</a></li>
   		  </ul>
        </li>
        <li><a href="http://www.aissolutions.ca/blog/" class="nlink">BLOG</a></li>
    </ul>
    </div>
<!-- Navigation End -->
<!-- Content Start -->
<div class="info">
    	<div class="right-top">
        	Latest News
        </div>
        Welcome to the New Website for AIS Solutions!  We have a new look and expanded range of <a href="services_for_business.html">services</a>, but have the same <a href="our_team.html">team</a> of professionals that you have come to depend on over the years. <img src="images/info-bottom.gif" alt="bottom" class="info-img"/><br />
    </div>
    <div class="info">
    	<div class="right-top">
        	Our Clients Speak
        </div>
        “The AIS team has a broad set of practical business operation experiences which they are able to harness in supporting your firm in an efficient, effective and customized manner.”<br/>
        <a href="our_clients_speak.html">Read Our Testimonials </a><img src="images/info-bottom.gif" alt="bottom" class="info-img"/><br />
    </div>
<a href="consultation.php" class="consultation"><img src="images/consultation-button.png" alt="Click here for a Free Consultation"/></a>
    <div class="secondary">
    <!-- InstanceBeginEditable name="Secondary-Content" -->
    	<div> <h1 class="grey-title">File Upload</h1>
   <p class="filesize"><span>NOTE:</span> You may upload 1-5 files at a time. Total upload size limit is 20MB. If you need to send a file which is greater than 20MB, please <a href="mailto:info@aissolutions.ca">contact us.</a><br /><br />
        **When uploading a large file or multiple files, please be patient and wait for the "Thank you for your submission" text to appear on the screen before you leave the page**</p>
        <br /><br />
         <?php error_reporting(0);

foreach($_POST as $key => $value){
    	if (is_array($value)) {
    		$_values[$key] = join("%,% ",$value);
    	}else $_values[$key] = $value;
      $_values[$key]=stripslashes($_values[$key]);
      }

if (!isset($_POST["_referer"])) {
	@$_referer = $_SERVER["HTTP_REFERER"];
}else $_referer = $_POST["_referer"];


$_ErrorList = array();

function mark_if_error($_field_name, $_old_style = ""){
global $_ErrorList;
	$flag=false;
	foreach($_ErrorList as $_error_item_name){
		if ($_error_item_name==$_field_name) {
			$flag=true;
		}
}
echo $flag ? "style=\"background-color: #FFCCBA; border: solid 1px #D63301;\"" : $_old_style;
}

function IsThereErrors($form, $_isdisplay) {
  global $_POST, $_FILES, $_values, $_ErrorList;
  $flag = false;
  if ($form > -1) {
  if ($_isdisplay) {
  	echo "<div style=\"border: 1px solid; margin: 10px auto; padding:15px 10px 15px 50px; background-repeat: no-repeat; background-position: 10px center; color: #D63301; background-color: #FFCCBA; max-width:600px; background-image:url('".$_SERVER["PHP_SELF"]."?image=warning');\">";
  }

  $flag = false;

  $req[0][] =  array("firstname", "firstname is required.");
  $req[0][] =  array("lastname", "lastname is required.");
  $req[0][] =  array("email", "email is required.");
  $req[0][] =  array("companynumber", "companynumber is required.");
  foreach($req[$form] as $field){
    if (!isset($_values[$field[0]]) or ($_values[$field[0]]=="")) {
      $flag = true;
      if ($_isdisplay) {
      	echo $field[1]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

  $files_req[0][] =  array("upload1", "upload1 is required.");
  foreach($files_req[$form] as $field){
    if (@$_FILES[$field[0]]["name"]=="") {
      $flag = true;
      if ($_isdisplay) {
      	echo $field[1]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

  $fields[0][] = array("email", '/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/', true, "email should be valid e-mail address.");
  $fields[0][] = array("companynumber", '/^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/', true, "companynumber should contain integer or floating point value only.");
  foreach($fields[$form] as $field){
    if (!(preg_match($field[1],$_values[$field[0]])==$field[2]) && $_values[$field[0]]!=""){
      $flag = true;
      if ($_isdisplay) {
      	echo $field[3]."<br>";
      	$_ErrorList[] = $field[0];
      }
    }
  }

	  $files[0][] = array("upload1", "true", "true", "You are trying to upload file with not allowed extension.", "true", "");
	  $files[0][] = array("upload2", "true", "true", "", "true", "");
	  $files[0][] = array("upload3", "true", "true", "", "true", "");
	  $files[0][] = array("upload4", "true", "true", "", "true", "");
	  $files[0][] = array("upload5", "true", "true", "", "true", "");
	  foreach($files[$form] as $file){
     $str = $file[1];
     if (eval("if($str){return true;}")) {
        $_values[$file[0]] = $_FILES[$file[0]]["name"];
        $dirs = explode("/","attachments//");
        $cur_dir =".";
        foreach($dirs as $dir){
        $cur_dir = $cur_dir."/".$dir;
        if (!@opendir($cur_dir)) { mkdir($cur_dir, 0777);}}
        $_values[$file[0]."_real-name"] = "attachments/".date("YmdHis")."_".$_FILES[$file[0]]["name"]."_secure";
        copy($_FILES[$file[0]]["tmp_name"],$_values[$file[0]."_real-name"]);
        @unlink($_FILES[$file[0]]["tmp_name"]);
     }else{
      $flag=true;
      if ($_isdisplay) {
      	//$ExtFltr = $file[2];
      	//$FileSize = $file[4];
        if (!eval("if($file[2]){return true;}")){echo $file[3];}
        if (!eval("if($file[4]){return true;}")){echo $file[5];}
      	$_ErrorList[] = $file[0];
      }
     }
  }

  if ($_isdisplay) {
  	echo "</div>";
  }
  }
  return $flag;
}


function display_page_upload_form($_iserrors) {
   global $_values, $_referer;?>
<html><SCRIPT LANGUAGE = "JavaScript">
var fields = {
"companynumber" : ["companynumber", /^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/, true, "Your Company Number should be entered with no spaces or hyphens."],
"email" : ["email", /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/, true, "Please ensure your email address is in a valid format."]
};
var req = {
"upload1" : ["upload1", "upload1 is required."],
"companynumber" : ["companynumber", "company number is required."],
"email" : ["email", "email is required."],
"lastname" : ["lastname", "last name is required."],
"firstname" : ["firstname", "first name is required."]
};
var validate_form = true;function CheckForm(){HideAllErrors();if(!validate_form)return true;var LastErrorField=null;for(var i in fields){isError=ValidateField(fields[i][0],fields[i][1],fields[i][2],fields[i][3]);if(isError)LastErrorField=isError}for(var i in req){isError=isFilled(req[i][0],req[i][1]);if(isError)LastErrorField=isError}if(LastErrorField){LastErrorField.focus();return false}else return true}function ShowTooltip(type,field,message){var IE='\v'=='v';var container;if(!(container=document.getElementById('error_list'))){var container=(IE)?(document.createElement('<div name="error_list">')):(document.createElement('div'));container=document.createElement('div');container.setAttribute('id','error_list');document.body.appendChild(container)}if(!document.getElementById(field+'_tooltip')){var elem=(IE)?(document.createElement('<div name="myName">')):(document.createElement('div'));var elem2=(IE)?(document.createElement('<div name="myName2">')):(document.createElement('div'));div_id=field+'_tooltip';elem=document.createElement('div');elem.setAttribute('id',div_id);elem.className="fe-"+type+"-container";elem.onmouseover=function(){MoveDivToTop(this)};elem.onclick=function(){HideTooltip(this.id)};elem2=document.createElement('div');elem2.className="fe-"+type;elem2.innerHTML=message;parentField=document.getElementsByName(field);var f=0;while(parentField[f].type=='hidden')f++;with(elem.style){top=findPos(parentField[f])[0]+'px';left=findPos(parentField[f])[1]+parentField[f].offsetWidth+'px'}elem.appendChild(elem2);container.appendChild(elem)}}function ValidateField(name,rule,condition,message){fld=document.getElementsByName(name);var i=0;while(fld[i].type=='hidden')i++;if(!(((fld[i].value.match(rule)!=null)==condition)||(fld[i].value==""))){ShowTooltip('error',fld[i].name,message);return fld[i]}return null}function isFilled(name,message){fld=document.getElementsByName(name);var isFilled=false;var i=0;while(fld[i].type=='hidden')i++;var obj=fld[i];for(j=i;j<fld.length;j++){if((fld[j].type=='checkbox')||(fld[j].type=='radio')){if(fld[j].checked)isFilled=true}else{if(fld[j].value!="")isFilled=true}}if(isFilled){return null}else{ShowTooltip('error',name,message);return obj}}function FieldBlur(elemId){HideTooltip(elemId);fieldName=elemId.replace(/(\S{0,})_tooltip/,"$1");if(typeof fields[fieldName]!='undefined'){ValidateField(fields[fieldName][0],fields[fieldName][1],fields[fieldName][2],fields[fieldName][3])}if(typeof req[fieldName]!='undefined'){isFilled(req[fieldName][0],req[fieldName][1])}}function HideTooltip(elemId){var elem=document.getElementById(elemId);var parent=document.getElementById('error_list');if((elem)&&(parent))parent.removeChild(elem)}function HideAllErrors(){error_container=document.getElementById('error_list');if(error_container!=null){while(error_container.childNodes.length>0){error_container.removeChild(error_container.firstChild)}}}function MoveDivToTop(div_to_top){div_container=document.getElementById('error_list');for(i=0;i<div_container.childNodes.length;i++)div_container.childNodes[i].style.zIndex="998";div_to_top.style.zIndex="999"}function findPos(obj){var curleft=curtop=0;do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent);return[curtop,curleft]}
</SCRIPT>
<style type="text/css"> .form_expert_style {display: none;}.fe-info,.fe-error{font:13px arial,helvetica,verdana,sans-serif;padding:2px;position:relative;top:-7px}.fe-error{border:solid 1px #d51007;background:#fbe3e4;color:#d51007}.fe-info{border:solid 1px #0187c5;background:#eff9ff;color:#0187c5}.fe-info-container,.fe-error-container{position:absolute;padding:0;border-left:8px solid transparent;-border-left:8px solid white;filter:progid:DXImageTransform.Microsoft.Chroma(color="white")}.fe-error-container{border-top:8px solid #d00}.fe-info-container{border-top:8px solid #0187c5} </style>

<?php //deafult number of upload boxes
$upload_quant = 4;
//if the user increased the number of boxes
if(isset($_POST['increase_upload']))
{
//increasing the number of upload boxes
$upload_quant = $_POST['previous_upload'] + 1;
}
$upload_quantity = $_POST['previous_upload'];
//getting all the names into an array
$uplaoded_array = array();
for($i=0;$i<$upload_quantity;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
$get_upload_name = $_POST['$upload_name'];
array_push($uplaoded_array,$get_upload_name);
} ?>

<form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);">
<?php IsThereErrors("0", $_iserrors); ?>
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="1">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>

<table>
<tr>
<td>First Name *</td>
<td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td>
</tr>
<tr>
<td>Last Name *</td>
<td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td>
</tr>
<tr>
<td>E-mail *</td>
<td><input type='text' size='30' name='email'  onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td>
</tr>
<tr>
<td>Company Number *</td>
<td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td>
</tr> 

<?php for($i=0;$i<$upload_quant;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
echo <<<_END
<tr>
<td>Upload $ii</td>
<td><input class="image" type='file' size='30' name='$upload_name'></td>
</tr>
_END;
}
echo <<<_END
<tr>
<td>
<input type="hidden" value="$upload_quant" name = "previous_upload"/>
<input type="submit" name="increase_upload" value="Add another upload box" />
</td>
<tr>
<td> </td>
<td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td>
</tr>
</table>
</form>
?>


</html>

<?php }  

function display_thankyou() {
   global $_values, $_referer;?>
<html>
<p style="margin-top:100px; padding-bottom:300px;"><b>Thank you for your submission</b></p>



</html>

<?php } 
function display_default() { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Successful submission</title><link rel="shortcut icon" href="http://forms-expert.com/images/favicon.ico" /><style>html,body,form,fieldset{margin:0;padding:0}html,body{   height:100%}body{color:#000;background:#FFF;font-family:Tahoma,Arial,Helvetica,sans-serif;line-height:160%}body#bd{padding:0;color:#333;background-color:#FFF}body.fs4{font-size:12px}.componentheading{color:#4F4F4F;font-family:"Segoe UI","Trebuchet MS",Arial,Helvetica,sans-serif;font-weight:bold}small,.small{color:#666;font-size:92%}ul{list-style:none}ul li{padding-left:30px;background:url(../images/bullet-list.gif) no-repeat 18px 9px;line-height:180%}.componentheading{padding:0 0 15px 0;margin-bottom:0px;color:#4F4F4F;background:url(http://forms-expert.com/images/dot.gif) repeat-x bottom;font-size:250%;font-weight:bold}#ja-header{height:60px;position:relative;z-index:999;width:920px;margin:0 auto;clear:both}#ja-containerwrap,#ja-footer{width:920px;margin:0 auto;clear:both}#main-container{ min-height:100%; /*height:100%;*/   position:relative}#ja-footerwrap{clear:both;border-top:1px solid #CCC;margin-top:10px;background:url(../images/grad2.gif) repeat-x top; position:absolute; bottom:0; width:100%; height:60px}#ja-footer{padding:15px 0;position:relative}#ja-footer small{padding:4px 0 0 10px;float:left;display:block;color:#999;font-style:normal;line-height:normal}small.ja-copyright{position:absolute;right:10px}#ja-footer a{color:#666;text-decoration:none}#ja-footer a:hover,#ja-footer a:active,#ja-footer a:focus{color:#666;text-decoration:underline}#ja-footer ul{margin:4px 0 5px 10px;padding:0;float:left;background:url(http://forms-expert.com/images/vline.gif) no-repeat center right;line-height:normal}#ja-footer li{margin:0;padding:0;display:inline;background:none}#ja-footer li a{padding:0 10px;display:inline;background:url(http://forms-expert.com/images/vline.gif) no-repeat center left;font-size:92%;line-height:normal}.clearfix:after{clear:both;display:block;content:".";height:0;visibility:hidden}* html >body .clearfix{width:100%;display:block}* html .clearfix{height:1%}/* Firefox Scrollbar Hack - Do not remove *//*html{margin-bottom:1px;height:100%!important;height:auto}*/a{color:#F90}a:hover,a:active,a:focus{color:#F90}#ja-containerwrap{padding:0;padding-bottom:60px}</style></head><body id="bd" class="fs4"><div id="main-container"><br><br><br><br><br><div id="ja-containerwrap">	<div id="ja-container" class="clearfix"><div style="padding: 20px 30px 20px 30px;"><div class="ja-innerpad clearfix"><div class="componentheading">Your submission was successful. Thank you.</div><p align="right">This form was processed by <a href="http://forms-expert.com">Forms Expert</a>.<p align="right">© 2009 Forms-Expert. </div></div></div></div><div id="ja-footerwrap"><div id="ja-footer" class="clearfix"><ul><li><a href="http://forms-expert.com">Visit Forms Expert</a></li><li><a href="http://forms-expert.com/form-processing-features/">Features</a></li><li><a href="http://forms-expert.com/download/">Download Beta</a></li><li><a href="http://forms-expert.com/support/">Support</a></li><li><a href="http://forms-expert.com/contactus/">Contact page</a></li></ul><small class="ja-copyright">© 2009 <a href="http://forms-expert.com/">Forms-Expert</a></small></div></div></div></body></html> <?php }
function display_spam_warning() { ?> <html>
<form action="" method="post"><style> .form_expert_style {display: none;} </style>
<?php IsThereErrors("1", $_iserrors); ?>
<input type="hidden" name="firstname" value="<?php echo htmlspecialchars($_values['firstname'])?>">
<input type="hidden" name="lastname" value="<?php echo htmlspecialchars($_values['lastname'])?>">
<input type="hidden" name="email" value="<?php echo htmlspecialchars($_values['email'])?>">
<input type="hidden" name="companynumber" value="<?php echo htmlspecialchars($_values['companynumber'])?>">
<input type="hidden" name="upload1" value="<?php echo htmlspecialchars($_values['upload1'])?>">
<input type="hidden" name="upload1_real-name" value="<?php echo htmlspecialchars($_values['upload1_real-name'])?>">
<input type="hidden" name="upload2" value="<?php echo htmlspecialchars($_values['upload2'])?>">
<input type="hidden" name="upload2_real-name" value="<?php echo htmlspecialchars($_values['upload2_real-name'])?>">
<input type="hidden" name="upload3" value="<?php echo htmlspecialchars($_values['upload3'])?>">
<input type="hidden" name="upload3_real-name" value="<?php echo htmlspecialchars($_values['upload3_real-name'])?>">
<input type="hidden" name="upload4" value="<?php echo htmlspecialchars($_values['upload4'])?>">
<input type="hidden" name="upload4_real-name" value="<?php echo htmlspecialchars($_values['upload4_real-name'])?>">
<input type="hidden" name="upload5" value="<?php echo htmlspecialchars($_values['upload5'])?>">
<input type="hidden" name="upload5_real-name" value="<?php echo htmlspecialchars($_values['upload5_real-name'])?>">
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="2">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>
<p align="center"><b>Your submission seems to be a SPAM. Please contact web site administrator or click "Back" button to return to the form.</b></p>
<p align="center"><input type="submit" name="back" value="< Back"></p></form>



</html>
<?php }
  function BuildBody($body, $html, $num){
   global $zag, $un;
   if ($html) {
       	  $zag[$num]       = "--".$un."\r\nContent-Type:text/html;\r\n";
       }
    else {
           $zag[$num]       = "--".$un."\r\nContent-Type:text/plain;\r\n";
     };
       $zag[$num]      .= "Content-Transfer-Encoding: 8bit\r\n\r\n$body\r\n\r\n";
  }
  function SendEmails (){
    global $_values, $zag, $un;
    $un        = strtoupper(uniqid(time()));
    $to[0] .= htmlspecialchars($_values["companynumber"]) . "@aissolutions.ca";
    $from[0]      .= "".str_replace("%,%", ",", $_values['email'])."";
    $subject[0]      .= "upload_form was submitted on ".date("F j, Y")." ".date("H:i")."";
    $head[0]     .= "MIME-Version: 1.0\r\n";
    $head[0]      .= "From: ".str_replace("%,%", ",", $_values['email'])."\r\n";
    $head[0]     .= "X-Mailer: Forms Expert at www.forms-expert.com\r\n";
    $head[0]      .= "Reply-To: ".str_replace("%,%", ",", $_values['email'])."\r\n";
    $head[0]     .= "Content-Type:multipart/mixed;";
    $head[0]     .= "boundary=\"".$un."\"\r\n\r\n";
    $EmailBody = "<html><body>
Form was filled with the following data:
<br><b>firstname:</b> ".htmlspecialchars($_values["firstname"])."
<br><b>lastname:</b> ".htmlspecialchars($_values["lastname"])."
<br><b>email:</b> ".htmlspecialchars($_values["email"])."
<br><b>companynumber:</b> ".htmlspecialchars($_values["companynumber"])."
<br><b>upload1:</b> ".htmlspecialchars($_values["upload1"])."
<br><b>upload2:</b> ".htmlspecialchars($_values["upload2"])."
<br><b>upload3:</b> ".htmlspecialchars($_values["upload3"])."
<br><b>upload4:</b> ".htmlspecialchars($_values["upload4"])."
<br><b>upload5:</b> ".htmlspecialchars($_values["upload5"])."
</body></html>
";
    BuildBody($EmailBody, True, 0);
    for ($i=0;$i<=0;$i++){
      mail($to[$i], $subject[$i], $zag[$i], $head[$i]);
    }
  }

$actions = array ("display_page_upload_form","display_thankyou");

session_start();
if(!isset($_SESSION["FormSent"])) {
  $_SESSION["FormSent"] = time();
  $delta = -1;
} else {
  $delta = time() - $_SESSION["FormSent"];
}

if (((strlen(trim(@$_POST["URL"])) > 0) or (($delta>-1)and($delta<2)))and(!isset($_POST["back"]))){
   display_spam_warning();
}else{
unset($_SESSION["FormSent"]);

if (in_array($_GET["image"], array("warning"))) {
	header("Content-type: image/png");
	echo base64_decode("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUisiGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQsf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJOyhSk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wFwYlbenSP7//W4McABBALEyMHI7SMqzs3x7cYfgNLGeYQHEPTCZMQFczsgIxKMmwQOohBiCbERhmzKzvGDycdBkcXOIYOP+cY/j36T3Db6C+/6BcBso5/yBR9f8vJGr+Qdl/f/1j+HrvNoOquhrbk9vcqUBVRwECiIWZjV36x6PXDN/+fmX4D7QAhJnYIJYxMUEiiRFU2AEx039YjvnHwPRxPwMX435gOQG1ENpnAKljAOL/oMgF8YHmgNT8h2bPL08+MrAAKywuPhYzkBaAAGL59vnVqSf3GBgUBYFFOjcjAzMnE7CEA1oGrAaYWBnBIQDyNZhmRDgI0q2BOIqJAWIZsPQB0/+hoQELgb8//0NyE9Alv7//Y7h/7gnD67cMm0FGAAQQi0VQ2frbpzZOPn37Rryk6H8+7l8sDGzfmBmYQaHAxAi2HGQRjIZ3qRiRa0/UnhM4KmA0KE39/sfw6/t/hl8f/zA8fwrMrFKqS0z9/dtAygECiBFUBnx4cZvh8/tnGoyMzLJAO7mAQc8G8TuSlaT0YRlRa3dgsfwXaM0vYFQB8Z8XvIJSVwQl1UBlKgNAADHiaTwyYRhFHviPhDEAQACx4HA7I5UsZ8BiDopDAAIMAP+QrU5p/QTlAAAAAElFTkSuQmCC");
}else{
	if (isset($_POST["_next_page"])) {
		$_next_page = $_POST["_next_page"];
	}else $_next_page = 0;

	if (isset($_POST["back"])) {
		call_user_func($actions[$_next_page-2],false);
	}else
		if (IsThereErrors($_next_page-1, false)){
			call_user_func($actions[$_next_page-1],true);
		}else {
			call_user_func($actions[$_next_page+0],false);
			if ($_next_page == count($actions)-1) {
				SendEmails();
				session_destroy();
			}
		}
	}
  }
?>
   </div>    
    <!-- InstanceEndEditable -->
</div>
    <img src="images/secondary-bottom.png" alt="bottom" class="stop"/>
<!-- Content End -->
</div>
<!-- Bottom Start -->
<div class="bottom">
<div class="contact2">
        Phone: 905.333.9637 | Toll Free 1.888.575.5385<br />
        Email: <a href="mailto:info@aissolutions.ca" class="clink">info@aissolutions.ca</a>
        <br /><br />
        <a href="#" class="clink">SITEMAP</a> | <a href="privacy_policy.html" class="clink">PRIVACY POLICY</a> | <a href="contact.html" class="clink">CONTACT</a>
    </div>
                 Customer Satisfaction is the cornerstone of our business.<br />
                    We believe so strongly in our  services that we give you<br />
                     a "Money Back" limited guarantee. <br/>
    <strong>                 Call now and ask    for details.  1-888-575-5385</strong><br />
</div>
<!-- Bottom End -->
</center></body>
<!-- InstanceEnd --></html>

But now I am getting this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/freewe8/public_html/formtest/upload.php on line 328

 

Does anyone know why? (besides the fact that I suck at PHP) :)

Link to comment
Share on other sites

Good call, thanks. Okay, so here is where I am at (almost there). Problem now is that the "add another upload box" button is acting as the "submit" button. See what I mean here: http://kmkwebdevelopment.com/formtest/upload.php

Here is the relevant snippet of code:

<?php //deafult number of upload boxes
$upload_quant = 4;
//if the user increased the number of boxes
if(isset($_POST['increase_upload']))
{
//increasing the number of upload boxes
$upload_quant = $_POST['previous_upload'] + 1;
}
$upload_quantity = $_POST['previous_upload'];
//getting all the names into an array
$uplaoded_array = array();
for($i=0;$i<$upload_quantity;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
$get_upload_name = $_POST['$upload_name'];
array_push($uplaoded_array,$get_upload_name);
} ?>

<form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);">
<?php IsThereErrors("0", $_iserrors); ?>
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="1">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>

<table>
<tr>



<td>First Name *</td>



<td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td>
</tr>
<tr>



<td>Last Name *</td>



<td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td>
</tr>
<tr>



<td>E-mail *</td>



<td><input type='text' size='30' name='email'  onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td>
</tr>
<tr>



<td>Company Number *</td>



<td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td>
</tr> 

<?php for($i=0;$i<$upload_quant;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
echo <<<_END
<tr>
<td>Upload $ii</td>
<td><input class="image" type='file' size='30' name='$upload_name'></td>
</tr>
_END;
}
echo <<<_END
<tr>
<td>
<input type="hidden" value="$upload_quant" name = "previous_upload"/>
<input type="submit" name="increase_upload" value="Add another upload box" />
</td>
<tr>

<td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td>
</tr>
</table>
</form>
_END;
}
?>	

</html>

<?php 

I appreciate the help :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.