Need help with error

Hi. Im a novice programmer and i need help with my “contact us” tab on my website. Ive been trying to make the page work but i just cant seems to get it right. my page is wwweecornwalluni.000webhostapp.com . can anybody help me?

I think you forgot to open <?php at the beginning of your php code

1 Like

Hi @aimanasrafroslan!

There was a syntax error in your PHP tag. I have corrected it for you :wink:

omg thank you. You guys always fast and reliable. since im using a template i dont know where to edit in the code so that the email will sent to me when user used the form. any idea where should i edit it? and also when i open my website it showed css3_redtulip on the browser tab, how do i change it? sorry for the late reply i have to wait for 4 hours in order to reply because its the first day

1 Like

@aimanasrafroslan

Edit your “contact.php” for this.

Edit your “index.html” and find this line,(also edit your other files and change the same)

then replace “CSS3_red_tulip” with your desired name.

which part in contact.php?

This is working well, it has been changed.[quote=“aimanasrafroslan, post:4, topic:71779”]
the code so that the email will sent to me when user used the form.
[/quote]

For your second question,
Here’s a code for sending mail in 000webhost.

<?php

$to = "THE ADDRESS YOU WANT TO SEND THE EMAIL TO";
$subject = "YOUR SUBJECT HERE";
$body = "YOUR BODY GOES HERE";
$headers = "MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8";
mail ($to, $subject, $body, $headers);

?>

Here’s a code for your contact.php:

<?php
if(isset($_POST['contact_submitted']{
  $name = $_POST['your_name'];
  $to = $_POST['your_email'];
  $message = $_POST['your_message'];
  $subject = 'New contact form from'.$name.'!';
  $body = $message.'Regards,'.$name;
  $headers = "MIME-Version: 1.0
  Content-Type: text/html; charset=UTF-8";
  mail ($to, $subject, $body, $headers);
}
?>

Is your issue solved??

sorry for the late reply. i havent fix it yet.

I edited it and made it work, it’ll now send emails to aimanasraf50@gmail.com

thanks man. you are a life saver

No problem, any other question, please do post a new topic :smiley: