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.

Contact php code

Featured Replies

Hello, I'm wondering if someone can be kind enough to at least give me some pointers with regards to creating a php script.

 

I have an xhtml page(s) that's the main contact form in which the php will get the data from, and I have a OK and failure page for after the button is pressed. I need php code to be exclusive to a php page and not mixed with the xhtml. The main css style sheet will style all webpages and the contact form in the xhtml page.

 

I need it to be secure and I'll try and try add recaptcha to it after.

 

I've looked at tecrite and phpmailer code, and seeing it has over 1,000 lines of code it kind of went way over my head.

 

<?php

// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); 
$EmailTo = "jon@mywebsite.com";
$Subject = "from web site";
$Name = Trim(stripslashes($_POST['Name'])); 
$Address = Trim(stripslashes($_POST['Address'])); 
$Telephone = Trim(stripslashes($_POST['Telephone'])); 
$message = Trim(stripslashes($_POST['message'])); 

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (Trim($message)=="") $validationOK=false;
if (!$validationOK) {
 print "<meta http-equiv=\"refresh\" content=\"0;URL=failure.htm\">";
 exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "message: ";
$Body .= $message;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page 
if ($success){
 print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
 print "<meta http-equiv=\"refresh\" content=\"0;URL=failure.htm\">";
}
?>

Hi,

 

I have a PHP (OOP) contact form processing script on a secure (SSL) server, you can use if your interested. Upon success or failure we can redirect the users back to any location you wish.

 

PM me if you interested.

 

Kyle

Edited by Kyle Hudson MCP CCNA CIW

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.