Jump to content

Need Coding Help: webform app data/upload capture to email


JStyl

Recommended Posts

Small intro: I am NOT a programer but either lucky/smart enough to have created a website and wrote majority of html code. I have exhausted my knowledge and research skills and have been smacked around for the past week on something that I am sure is simple for someone. I need help with my process.php file coding and or what ever other files are involved in capturing my html applications form data/ image upload and sending it to my email address. I have been able to receive the email with subject and from populated, but not getting message body information to populate. Could someone please look at this php file below and explain to me how to create the code needed(highlight it please and in layman terms) :D so I can see where I went wrong.  :'(    ...

 

<?php

include("global.inc.php");

$errors=0;

$error="The following errors occured while processing your form input.<ul>";

pt_register('POST','BirthDate');

pt_register('POST','FirstName');

pt_register('POST','LastName');

pt_register('POST','AliasAKA');

pt_register('POST','ContactNumber');

pt_register('POST','Besttimetocall');

pt_register('POST','EmailAddress');

pt_register('POST','Howdidyouhearaboutus');

$1PictureUpload=$HTTP_POST_FILES['1PictureUpload'];

$2PictureUpload=$HTTP_POST_FILES['2PictureUpload'];

$PictureUpload=$HTTP_POST_FILES['PictureUpload'];

pt_register('POST','Describeyourselfin3wordorless');

if($BirthDate=="" || $FirstName=="" || $LastName=="" || $AliasAKA=="" || $ContactNumber=="" || $Besttimetocall=="" || $1PictureUpload=="" || $2PictureUpload=="" ){

$errors=1;

$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";

}

if(!is_uploaded_file($HTTP_POST_FILES['1PictureUpload']['tmp_name'])){

$error.="<li>The file, ".$HTTP_POST_FILES['1PictureUpload']['name'].", was not uploaded!";

$errors=1;

}

if(!is_uploaded_file($HTTP_POST_FILES['2PictureUpload']['tmp_name'])){

$error.="<li>The file, ".$HTTP_POST_FILES['2PictureUpload']['name'].", was not uploaded!";

$errors=1;

}

if($HTTP_POST_FILES['PictureUpload']['tmp_name']==""){ }

else if(!is_uploaded_file($HTTP_POST_FILES['PictureUpload']['tmp_name'])){

$error.="<li>The file, ".$HTTP_POST_FILES['PictureUpload']['name'].", was not uploaded!";

$errors=1;

}

if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$EmailAddress)){

$error.="<li>Invalid email address entered";

$errors=1;

}

if($errors==1) echo $error;

else{

$image_part = date("h_i_s")."_".$HTTP_POST_FILES['1PictureUpload']['name'];

$image_list[16] = $image_part;

copy($HTTP_POST_FILES['1PictureUpload']['tmp_name'], "files/".$image_part);

$image_part = date("h_i_s")."_".$HTTP_POST_FILES['2PictureUpload']['name'];

$image_list[17] = $image_part;

copy($HTTP_POST_FILES['2PictureUpload']['tmp_name'], "files/".$image_part);

$image_part = date("h_i_s")."_".$HTTP_POST_FILES['PictureUpload']['name'];

$image_list[18] = $image_part;

copy($HTTP_POST_FILES['PictureUpload']['tmp_name'], "files/".$image_part);

$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

$message="Birth Date: ".$BirthDate."

First Name: ".$FirstName."

Last Name: ".$LastName."

Alias AKA: ".$AliasAKA."

Contact Number: ".$ContactNumber."

Best time to call: ".$Besttimetocall."

Email Address: ".$EmailAddress."

How did you hear about us: ".$Howdidyouhearaboutus."

1 Picture Upload: ".$where_form_is."files/".$image_list[16]."

2 Picture Upload: ".$where_form_is."files/".$image_list[17]."

Picture Upload: ".$where_form_is."files/".$image_list[18]."

Describe yourself in 3 word or less: ".$Describeyourselfin3wordorless."

";

$message = stripslashes($message);

mail("[email protected]","Application Submitted at your website", $message ,"From: phpFormGenerator");

$make=fopen("admin/data.dat","a");

$to_put="";

$to_put .= $BirthDate."|".$FirstName."|".$LastName."|".$AliasAKA."|".$ContactNumber."|".$Besttimetocall."|".$EmailAddress."|".$Howdidyouhearaboutus."|".$where_form_is."files/".$image_list[16]."|".$where_form_is."files/".$image_list[17]."|".$where_form_is."files/".$image_list[18]."|".$Describeyourselfin3wordorless."

";

fwrite($make,$to_put);

 

 

header("Refresh: 0;url=http://www.mydomain.com/thankyou.html");

?><?php

}

?>

Hope I dont get in trouble for posting all that...

okay thanks. I used a program called phpFormGenerator to create the application and it created all the coding. To my understanding pt_register is a old version of the way $_POST is now used. I could be way wrong but here is something else that I found.. on a site call stackoverflow.com

 

"What pt_regsiter does is allow you export an individual variable from one of these arrays into the global scope. So instead of writing

 

global          $HTTP_SERVER_VARS

global          $php_self;

$php_self      = $HTTP_SERVER_VARS['PHP_SELF']

 

You could write.

 

pt_register('SERVER','PHP_SELF');

 

And you'd have a $php_self variable in the global scope."

 

????  :shrug:

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.