So I have a contact form and a PHP script coded on Dreamweaver. All has been uploaded to the Remote Server. A Web App has been created in Azure.
However, upon testing this, I get the good old "This page cannot be displayed" page that we all love!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<?php
if(isasset($_POST{'formSubmit'})){
$name=$_POST['firstName'];
$surname=$_POST['surname'];
$companyName=$_POST['companyName'];
$email=$_POST['yourEmail'];
$to='todd.gilbey#indomtrading.com';
$subject='Form Submission';
$message="Name: ".$name."\n"."Surname: ".$surname."\n". "Wrote the following: "."\n\n".$companyName;
$headers="From: ".$email;
if(mail($to, $subject, $message)){
echo("Sent Successfully");
}
}
?>
</body>
</html>
<form action="handler_mail.php" method="post">
<input class="formInput" type="text" name="firstName" placeholder="First Name"/><br>
<input class="formInput" type="text" name="surname" placeholder="Surnames"/><br>
<input class="formInput" type="text" name="companyName" placeholder="Company/Production Name"/><br>
<input class="formInput" type="email" name="yourEmail" placeholder="Email address"/><br>
</form>
According to the Azure help team, the web app person already has PHP enabled so I don't see what the problem is.
I have my coding here to see if anyone has any idea what I'm missing.
Thanks
You have a typo in your code:
if(isasset($_POST{'formSubmit'})){
should be
if(isset($_POST{'formSubmit'})){
that might cause an error.
In Azure App Service, you should put all website pages into the default folder for IIS (D:\home\site\wwwroot).
You can change it from the Azure portal if needed.
Related
I build a website which has a form. Contact form redirects to contact.php on submit. For some reason whenever I submit, it says page not found.
index.html
...
<form action="contact.php" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name" class="form-control" required><br>
E-mail:<br>
<input type="email" name="mail" class="form-control" required><br>
Message:<br>
<input type="text" name="comment" size="50" class="form-control" required><br><br>
<button type="submit" value="Send"> Send Message </button>
</form>
...
contact.php
<?php
if($isset($_POST['submit']))
{
$name = $_POST['name'];
$mailFrom = $_POST['mail'];
$message = $_POST['comment'];
$mailTo = "sample#email.com";
$headers = "From: ".$mailFrom;
mail($mailTo, $name, $message, $headers);
header("Location: index.html");
}
?>
I added a build.sh file containing:
#!/bin/bash
php contact.php
I also added ./build.sh in build command. I feel my script is wrong. Please suggest me alternatives to solve this problem.
A Netlify site is deployed to a CDN and serves up static content and although you can run PHP at the time of a deploy, you cannot execute PHP during a page request.
To submit a form, you can use Netlify Forms or some other serverless forms solution.
I recommend using InfinityFree for hosting the PHP site for free. or if your need is just to send an email form and the rest is static pages then i recommend emailjs that will let you send emails for free. so that you can deploy your site in netlify or vercel
You can use 000webhost.com hosting for uploading your php projects.
Im getting this error message using xampp i couldnt figure out if it was the code or i needed to configure something in xampp im using windows 7
it works usually but for some reason the _get crashes it i think
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
here is my php code
<?php
if (isset($_GET('day'))){
};
//echo $_get('day');
$text = 'Hello World.'
?>
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<form action="index.php" method="GET">
day:<input type="text" name="day"value=""><br />
date:<input type="text" name="date"value=""><br />
name:<input type="text" name="name"value=""><br />
email:<input type="text" name="email"value=""><br />
<input type="submit"value = "submit">
</form >
</body>
</html>
i know this question has been asked before but i couldn't find a helpful answer
I am currently going through elithecomputerguy's youtube playlist for php programming. I am on part 7 of his 11 part series, this section talks about sending email with php. He writes out all the php code on notepad++ and uploads it to a standard godaddy web hosting account. I am using the same exact method, copying his code line by line, setting up the files in the same location and when I upload my email_form.php, it displays correctly
<HTML>
<HEAD>
</HEAD>
<BODY>
<form action="email_script.php" method="POST">
<p>Email Address: <input type="text" name="email" size="30"></p>
<p>Subject: <input type="text" name="subject" size="30"></p>
<p>Message: </p>
<p><textarea rows="10" cols="20" name="message"></textarea></p>
<input type="submit" name="submit" value="Submit">
</BODY>
</HTML>
Now I uploaded my email_script.php file just fine and it looks like so:
<?PHP
$from="test#mikesmtgadvice.com";
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
mail($email, $subject, $message,"From:".$from);
print "Your message has been sent: </br?$email</br>$subject</br>$message</p>
?>
so when I go to mysite.com/test/email_form.php, it works and displays this form the way it should. However, when I fill in the form and hit submit, when it tries running the script, I get an 500 Internal Server Error. I have no idea where to look for this error and cannot find the error log, and therefore cannot figure this out. In the video, he does this exact same process and it works, is there a setting I need to change in my server or?
Thank you for your help in advance, I'm sorry for the long winded version but I wanted to be as specific as possible.
You are missing a double quote and ; at the end of the print statement:
print "Your message has been sent: <br />$email<br />$subject<br />$message</p>";
Replace that with your print line and it will fix it.
Our university provides a public folder to every student where we put out html files and host our own website.
My question is:
Am I able to do some server-side programming in this situation? I found this example from w3school:
client-side:
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
server-side:
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
I put both files under the folder, but nothing works. I am sorry that this might be a stupid question. But I would really like to find out what is happening.
Thank you guys so very much in advance!
The host space they provide may not have enabled PHP for you to use
I have this two files:
index.html
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
And welcome.php
<html>
<body>
Welcome, <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
This is example from there
When the user fills the form and hits "enter" it should display:
Welcome, the_name_you_enter
Your email address is address_you_enter
But for me it only displays welcome.php source code (I am using Safari 7).
Does anyone knows why?
It sounds like your calling up the page from a server that is not executing php.
This usually happens because the PHP file is not executed on a web server or PHP is not enabled on your webserver.
You are probably trying to access the file directly using file://
Take a look at MAMP (I am assuming you are using OS X)