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.

Correct way do this?

Featured Replies

This script works fine, but there's a part I'm not sure if there's an easier / better way to do it. The part I'm talking about is commented in the script. Also any general advice on improvements if there are any to be would be cool.

<?php
if (isset($_POST['submit'])) {
    
    //Variables
    $name  = Trim(stripslashes($_POST['name']));
    $email = Trim(stripslashes($_POST['email']));
    $id    = rand(1000, 9999);
    
    //Headers
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: email@email.co.uk' . "\r\n";
    $headers .= 'Cc: email@email.co.uk' . "\r\n";
    
    //Email Information
    $to      = $email;
    $subject = 'Project Information';
    
    //Email Body
    $message = '<html><body>';
    $message .= '<h1>Message</h1>';
    $message .= '<h1>Quote ID</h1>';
    $message .= '<p>' . $id . '</p>';
    if (!empty($name)) {
        $message .= '<h1>Name</h1>';
        $message .= '<p>' . $name . '</p>';
    }
    $message .= '<h1>Message</h1>';
    $message .= '<a href="http://www.domain.com/clients/' . $name . '.php">Link</a>';
    $message .= '</body></html>';
    
    //Send Email
    if (mail($to, $subject, $message, $headers)) {
        echo 'Message Sent';
    } else {
        echo 'Message Failed';
    }
    
    //Unsure about this
    //Here a php page is generated by the main php
    //I've done it like the message above but I'm unsure if this is correct?
    $request = '<?php ';
    $request .= '$headers = "From: email@email.co.uk"."\r\n";';
    $request .= '$to = "email@email.co.uk";';
    $request .= '$subject = "Invoice Request";';
    $request .= '$message = "' . $name . ' is requesting ' . $id . ' quote";';
    $request .= 'mail($to, $subject, $message, $headers);';
    $request .= 'unlink(__FILE__)';
    $request .= ' ?>';
    $request .= '<h1>Invoice Being sent asap</h1>';
    
    //Write the above php to a file
    $myfile = fopen('clients/' . $name . '.php', 'w');
    fwrite($myfile, $request);
    fclose($myfile);
    
}

?>

Edited by Brock

  • 6 months later...

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.