My former boss wanted me to add a drop down menu to his request a quote form on his website. I have no experience with PHP and I’m not the webmaster of this site(I know I shouldn’t be doing this so please hold back on those comments and please try to help me). But he gave me the login info to his cpanel so I can change the files. All I needed to do was add a drop down menu to the form.
Looking over the PHP, it seemed pretty straightforward. This is what the PHP looked like. I only added two lines of code and now the owner can’t even receive this form from customers?
<?php
//$to = "techlysesolutions@gmail.com";
// $to = "info@gilbertmovingandstorage.com";
$to = "gilbertmovingandstorage@gmail.com";
$fname = $_POST['element_1_1'];
$lname = $_POST['element_1_2'];
$email = $_POST['element_5'];
$phone = $_POST['element_6_1'];
$message = $_POST['element_7'];
// pickup address
$pick_add1 = $_POST['element_2_1'];
$pick_add2 = $_POST['element_2_2'];
$pick_add3 = $_POST['element_2_3'];
$pick_add4 = $_POST['element_2_4'];
$pick_add5 = $_POST['element_2_5'];
$pick_add6 = $_POST['element_2_6'];
// Drop Off Address address
$drop_add1 = $_POST['element_3_1'];
$drop_add2 = $_POST['element_3_2'];
$drop_add3 = $_POST['element_3_3'];
$drop_add4 = $_POST['element_3_4'];
$drop_add5 = $_POST['element_3_5'];
$drop_add6 = $_POST['element_3_6'];
//Date
$month = $_POST['element_4_1'];
$day = $_POST['element_4_2'];
$year = $_POST['element_4_3'];
$ref = $_POST['element_4_4']; // I ADDED THIS LINE------------------------
$date = $month.'/'.$day.'/'.$year;
$subject = "Contact Inquiry";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From:".$email;
//$headers .= "BCC: admin@example.com";
echo $txt = '<table width="300">
<tr><td></td><td>'.$fname.' '.$lname.'</td></tr>
<tr><td></td><td>'.$email.'</td></tr>
<tr><td></td><td>'.$phone.'</td></tr>
<tr><td style="font-weight:bold"></td></tr>
<tr><td></td><td>'.$pick_add1.'</td></tr>
<tr><td></td><td>'.$pick_add2.'</td></tr>
<tr><td></td><td>'.$pick_add3.'</td></tr>
<tr><td></td><td>'.$pick_add4.'</td></tr>
<tr><td></td><td>'.$pick_add5.'</td></tr>
<tr><td></td><td>'.$pick_add6.'</td></tr>
<tr><td style="font-weight:bold"></td></tr>
<tr><td></td><td>'.$drop_add1.'</td></tr>
<tr><td></td><td>'.$drop_add2.'</td></tr>
<tr><td></td><td>'.$drop_add3.'</td></tr>
<tr><td></td><td>'.$drop_add4.'</td></tr>
<tr><td></td><td>'.$drop_add5.'</td></tr>
<tr><td></td><td>'.$drop_add6.'</td></tr>
<tr><td></td><td>'.$date.'</td></tr>
<tr><td>Moving Date</td><td>'.$ref.'</td></tr> // I ADDED THIS LINE----------
<tr><td></td><td>'.$message.'</td></tr>
</table>';
mail($to,$subject,$txt,$headers);
As you can see I only added two lines. But I’ve since removed those lines when I found out I broke the whole thing, so it should be as if I never touched the file. Yet it still doesn’t work. I have no clue what to do.(I’m new to web dev so I’m not very technical) I’ve been told to check the php error log, except this creates a whole other problm. The two methods I tried didn’t pan out. I was told to find and edit the ini.php file and turn error logging on. I can’t find this file though the instruction were unclear on where it was, then someone told me
“if you’re on cPanel logging is probably already enabled. Look in your “logs” folder and you’ll likely see a file called “error_log”. If it’s not there, and you haven’t got access to a copy of php.ini, then ask your hosting support people to turn on PHP error logging for you.”
I found this file, but there is nothing in it. I tried viewing it in the cpanel and in notepad but its blank??
Please help guide me through this I’m on a time limit and I need to somehow fix this asap.