I have a website, which has a page designed to be left open during a tradeshow, so that anyone can leave contact details. My issue is that the plesk server that the website is currently hosted on can't seem to handle a simple PHP script to store this data.
Here's my PHP:
<?
if(isset($_POST['DistName'])){
$del = "\ ";
$data[1] = $_POST['name'];
$data[2] = $_POST['email'];
$data[3] = $_POST['phone'];
$data[4] = $_POST['comment'];
$file = fopen("customer_details.csv", "a");
$data = "\\
".implode($del, $data);
fwrite($file, $data);
fclose($file);
echo "The data has been added successfully";
}else{
header("location: form.php");
}
?>
and here's the form:
<section id="contact" class="section-bg">
<div class="container">
<div class="section-header">
<h3>Contact</h3>
<p>Please leave your contact info and we will get back to you</p>
</div>
<div class="form">
<div id="sendmessage">Your message has been sent. Thank you!</div>
<div id="errormessage"></div>
<form action="details.php" method="get" class="contactForm">
<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="name" class="form-control" id="name" placeholder="Your Name" data-rule="minlen:4" data-msg="Please enter at least 4 chars" />
<div class="validation"></div>
</div>
<div class="form-group col-md-6">
<input type="email" class="form-control" name="email" id="email" placeholder="Your Email" data-rule="email" data-msg="Please enter a valid email" />
<div class="validation"></div>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="phone" id="phone" placeholder="Your phone #" data-rule="minlen:10" data-msg="Please enter a 10 digit phone number" />
<div class="validation"></div>
</div>
<div class="form-group">
<textarea class="form-control" name="comment" id="comment" rows="5" data-msg="Please write something for us" placeholder="comments"></textarea>
<div class="validation"></div>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>
</div>
</div>
</section><!-- #contact -->
Is there something I need to change in the server settings? It's extremely hard to find anything useful in plesk, so I may be missing something. I can;t find any errors in the code posted here.