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.

Sending information via PHP

Featured Replies

Hi Im trying set up a page where users can send their email addy via PHP

It works fine when I use one of my own addys (info@aardesign.co.uk) but when I test it on other addys it doesn't work

 

This is the HTML for the page:

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">'>http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>lime_home</title>

<link href="limestylesheet.css" rel="stylesheet" type="text/css" media="screen" />

</head>

 

<body>

 

<div id="background">

<div id="peel"><img src="grain.png" width="800" height="500" border="0" /></div>

 

<div id="fresh"><img src="fresh.png" alt="logo" width="570" height="150" border="0"/></div>

<div id="soon"><img src="comingsoon.png" width="500" height="100" border="0"/></div>

<div id="emailtext">Submit your email to be notified when we go live</div>

 

<div id="bar"><img src="middlebar.png" width="1000" height="68" border="0"/></div>

<div id="emailsend">

<form action="feedback.php" method="post"enctype="multipart/form-data">

 

 

 

<input type="text" name="comments" size="50">

<input type="submit" class="submitButton" value="Submit" />

</p>

</form>

</div>

<div id="maintext">Lime4 is a fresh company providing clear thinking and high quality expertise in project management and the development of

sustainable solutions. Whether through project development, production of business cases and feasibilities, or more specifically

related to the blossoming green and environmental sector.</div>

<div id="limelogo"><img src="limelogo.png" width="170" height="135" border="0"/></div>

<div id="address">Studio B, Derwentside Business Centre, Consett Business Park Consett, DH8 5BP</div>

<div id="details">Phone : 01207 693 913 Mobile: 07729 327 323 e-mail: chris@lime4.co.uk</div>

</div>

</body>

</html>

 

This is the PHP which it is linked to

 

<?php

$comments = $_POST['comments'];

$to = "info@echographics.co.uk";

$re = " New website email feedback";

$msg = $comments;

mail ( $to, $re, $msg );

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

 

<body>

<h1>Thanks for your email address, we will be in touch.<h1>

</body>

</html>

 

This is the page in question

http://www.aardesign.co.uk/lime/index.html

 

Can anyone help ?

Thanking you.

Alan.

I presume your input field named 'comments' is where people are putting their email address...

 

So you're saying that if you change your $to variable - the email is not delivered?

 

BTW - you have a lot of divs - you could trim a fair few of those out.

You haven't got a From part of the mail function. An email has To, Subject, Message and From and you have only three parts.

Add a variable and add it into the mail function:

$from = "info@echographics.co.uk";
mail ( $to, $re, $msg, $from );

 

I hope that works. It should provide the basic operation but your form is open to security problems. You could get PHP code from an online source like

http://www.emailmeform.com/

or

http://www.formmail.com/

 

Don't worry about the To and From being the same address, that's a good idea. At least, the From should be from the same domain as your host's server ie the domain name should be the same for both. If ISPs or hosts see a different From address to the domain name of the form, they think it's spam and often block the mail.

You haven't got a From part of the mail function. An email has To, Subject, Message and From and you have only three parts.

Add a variable and add it into the mail function:

$from = "info@echographics.co.uk";
mail ( $to, $re, $msg, $from );

 

I hope that works. It should provide the basic operation but your form is open to security problems. You could get PHP code from an online source like

http://www.emailmeform.com/

or

http://www.formmail.com/

 

Don't worry about the To and From being the same address, that's a good idea. At least, the From should be from the same domain as your host's server ie the domain name should be the same for both. If ISPs or hosts see a different From address to the domain name of the form, they think it's spam and often block the mail.

 

Should from not be

$from = "From: info@echographics.co.uk \n\r";

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.