Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to get the results from php-script embedded in the webpage

Featured Replies

I have a html page with a form that allows a user to send an email to me. It works, and I get the email when i press the submit-button.

 

But how do I display the original html-page with a <p>Thanks for the mail</p> in the content, instead of a new, blank page like the php-code does.

 

 

Here`s the current code:

<?php
$to = "tthorki@gmail.com";
$from = $_POST['avsender'];
$subject = $_POST['tema'];
$message = $_POST['beskjed'];

if (mail($to, $from, $message)) {
echo "<p>Thanks for the mail</p>";
} else {
	echo "<p>Mail wasnt sendt.</p>";
}
?>

 

I want the echoes above to appear on a similar html-page as the form, not on a new blank one wich this generates.

 

Hope someone can help=)

ok so we need to play about with the server because the html page wont have the php engine available

 

assuming the contact.html page is in the wwwroot/public_html... and your running on linux

 

fist edit the file .htaccess and put this in- edit the names to fit if you have these pages in a folder add this without the slash at the front i.e

 

folder/contact.html folder/contact.php

 

RewriteEngine On
RewriteBase /
RewriteRule contact.html contact.php

 

then rename your contact.html page to contact.php... now in your browser take allok at the contact.html page... if nothing has changed it worked... so then just add the below code to your contact page and your done

 

<?php

if(isset($_POST['beskjed'])){


$to = "tthorki@gmail.com";
$from = $_POST['avsender'];
$subject = $_POST['tema'];
$message = $_POST['beskjed'];

if (mail($to, $from, $message)) {
echo "<p>Thanks for the mail</p>";
} else {
echo "<p>Mail wasnt sendt.</p>";
}


}

 

hope that helps

forget echo "<p>Thanks for the mail</p>";

 

and just redirect to a html page that contains "<p>Thanks for the mail</p>"

 

if (mail($to, $from, $message)) {

header("Location: ok.html");

} else {

header("Location: fail.html");

}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.