Jump to content

Webform on Godaddy


eleverson

Recommended Posts

I have a Ultimate Web Hosting Linux account with Godaddy. I am using the pre-built webform godaddy provides which is the gdform.php. The form works the only problem I wanted to add a file upload and this form does not support it. I need help making a customize form. I have tried to add to the form and still not receiving the file.

 

html code

 

 

 <form action="/gdform.php" method="post">
            <h1>Your Information</h1>
<input type="hidden" name="subject" value="Form Submission"
<input type="hidden" name="redirect" value="thankyou.html" />
<a href="https://cid-31240a340806bd09.calendar.live.com/calendar/private/65823f73-7ada-4c07-ad10-7f2023657d03/392aa04c-6892-452d-986b-b5cd70bed1a7/index.html" target="_blank" >View Appointment Calendar</a><br>
<img src="kelly3.jpg" alt="lace front wig"  class="kelly3">
<p>First Name <input type="text" name="first_name" size="40" maxlength="35" /></br</p>
<p>Last Name <input type="text" name="last_name" size="40" maxlength="35" /></br></p>

<p>Email <input type="email" name="email" size="40" maxlength="35" required /></br></p>
<p>Telephone<input type="tel" name="tel" size="40" maxlength="35"/></br></p>
<p>Please provide information on the hair services you are interested in.</p>
 <textarea name="info" cols="40" rows="10">
</textarea><br>

 
 
 <form enctype="multipart/form-data">
<p>Please upload your hair style photos</p><input type="file" name="file" accept="image/jpg,image/gif,image/png">

<input type="submit" name="submit" value="submit"  style="background-color: #f00;font-size:24px; margin-top: 60px; margin-left: 415px; "/>        
</form>
</form>

 

 

 

php code

 

 

<?php
    $request_method = $_SERVER["REQUEST_METHOD"];
    if($request_method == "GET"){
      $query_vars = $_GET;
    } elseif ($request_method == "POST"){
      $query_vars = $_POST;
    }
    reset($query_vars);
    $t = date("U");

    $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
    $fp = fopen($file,"w");
    while (list ($key, $val) = each ($query_vars)) {
     fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
     fputs($fp,"$val\n");
     fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
     if ($key == "redirect") { $landing_page = $val;}
    }
    fclose($fp);
    $allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowedExts))
    if ($landing_page != "thankyou.html"){
    header("Location:thankyou.html");
    } else {
    header("Location: http://".$_SERVER["HTTP_HOST"]."thankyou.html");
    }


?>

 

 

 

I receive an email with just a name of the attachment. If you guy's can give me a whole another php code that could work it would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/284254-webform-on-godaddy/
Share on other sites

Your form code should be

 <form action="/gdform.php" method="post" enctype="multipart/form-data">
            <h1>Your Information</h1>
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
<a href="https://cid-31240a34...d1a7/index.html" target="_blank" >View Appointment Calendar</a><br> 
<img src="kelly3.jpg" alt="lace front wig"  class="kelly3">
<p>First Name <input type="text" name="first_name" size="40" maxlength="35" /></br</p>
<p>Last Name <input type="text" name="last_name" size="40" maxlength="35" /></br></p>

<p>Email <input type="email" name="email" size="40" maxlength="35" required /></br></p>
<p>Telephone<input type="tel" name="tel" size="40" maxlength="35"/></br></p>
<p>Please provide information on the hair services you are interested in.</p>
 <textarea name="info" cols="40" rows="10">
</textarea><br>

<p>Please upload your hair style photos</p><input type="file" name="file" accept="image/jpg,image/gif,image/png">

<input type="submit" name="submit" value="submit"  style="background-color: #f00;font-size:24px; margin-top: 60px; margin-left: 415px; "/>        
</form>
Link to comment
https://forums.phpfreaks.com/topic/284254-webform-on-godaddy/#findComment-1460135
Share on other sites

I also tried to use this php code on my website and it didn't send me all the info

 

 

<?php
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $email = $_POST['email'];
    $tel = $_POST['tel'];
    $info = $_POST['info'];
    $file = $_Files['files'];
    $file_name = $file['name'];
    $file_size = $file['size'];
    $file_tmp_location =$file['tmp_name'];
    $file_type = $file['type'];
    $to = "[email protected]";
    $subject ="Salon Client";
 
    mail($to, $subject,$info,$email,$tel,$file "From:" . $first_name . $last_name);
   header('Location:thankyou.html');
?>
 
 
I might be missing something
Link to comment
https://forums.phpfreaks.com/topic/284254-webform-on-godaddy/#findComment-1460165
Share on other sites

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.