Welkom gast! Aanmelden Registreren


Waardering:
  • 0 stemmen - gemiddelde waardering is 0
  • 1
  • 2
  • 3
  • 4
  • 5
Vraag (PLUCK)
#1
Hoi, Ik ben bezig met het aanpassen van een contact script naar een simpel bestel script, in pluck cms. Nu is alleen het probleem dat hij niet alle informatie mee zend naar het email adres dat bekend is in het systeem. graag zou ik ook willen dat diegene die een email stuurt ook een kopie krijgt. iemand enig idee hoe dit mogelijk is?

Heb al om hulp gevraagd op het support forum van pluck maar daar werd ik niet veel wijzer van. (zie zijn reactie onder het script)

Code:
<?php
/*
* This file is part of pluck, the easy content management system
* Copyright (c) pluck team
* http://www.pluck-cms.org

* Pluck is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* See docs/COPYING for the complete license.
*/

//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');

function bestelpagina_theme_main() {
    global $lang;

    //Define some variables.
    if (isset($_POST['bestelpagina_name']))
        $name = $_POST['bestelpagina_name'];
    if (isset($_POST['bestelpagina_sender']))
        $sender = $_POST['bestelpagina_sender'];
    if (isset($_POST['bestelpagina_message']))
        $message = $_POST['bestelpagina_message'];

    //If the the bestelpagina was submitted.
    if (isset($_POST['submit'])) {
        //Check if all fields were filled.
        if ($name && $sender && $message) {
            //TODO: We need a better way to check for spam.

            //Sanitize the fields.
            $name = sanitize($name);
            $sender = sanitize($sender);
            $message = sanitize($message);

            //Change enters in their html-equivalents.
            $message = nl2br($message);

            //Now we're going to send our email.
            if (mail(EMAIL, $lang['bestelpagina']['email_title'].$name, '<html><body>'.$message.'</body></html>', 'From: '.$sender."\n".'Content-type: text/html; charset=utf-8'))
                echo $lang['bestelpagina']['been_send'];
            //If email couldn't be send.
            else
                echo $lang['bestelpagina']['not_send'];
        }
        //If not all fields were filled.
        else
            echo '<p class="error">'.$lang['bestelpagina']['fields'].'</p>';
    }

    //Then show the bestelpagina.
    ?>
        <form method="post" action="" id="bestelpagina">
            <div>
                <label for="bestelpagina_name"><?php echo $lang['general']['name']; ?></label>
                <br />
                <input name="bestelpagina_name" id="bestelpagina_name" type="text" />
                <br />
    <label for="bestelpagina_adres"><?php echo $lang['general']['adres']; ?></label>
                <br />
                <input name="bestelpagina_straatnaam" id="bestelpagina_adres" type="text" />
                <br />
<label for="bestelpagina_straatnaam"><?php echo $lang['general']['postcode']; ?></label>
                <br />
                <input name="bestelpagina_postcode" id="bestelpagina_postcode" type="text" />
                <br />
<label for="bestelpagina_plaats"><?php echo $lang['general']['plaats']; ?></label>
                <br />
                <input name="bestelpagina_plaats" id="bestelpagina_plaats" type="text" />
                <br />
<label for="bestelpagina_telefoon"><?php echo $lang['general']['telefoon']; ?></label>
                <br />
                <input name="bestelpagina_telefoon" id="bestelpagina_telefoon" type="text" />
                <br />
<label for="bestelpagina_land"><?php echo $lang['general']['land']; ?></label>
                <br />
                <input name="bestelpagina_land" id="bestelpagina_land" type="text" />
                <br />

<label for="bestelpagina_sender"><?php echo $lang['general']['email']; ?></label>
                <br />
                <input name="bestelpagina_sender" id="bestelpagina_sender" type="text" />
                <br />
                <label for="bestelpagina_message"><?php echo $lang['general']['opmerkingen']; ?></label>
                <br />
                <textarea name="bestelpagina_message" id="bestelpagina_message" rows="7" cols="45"></textarea>
                <br />
                <input type="submit" name="submit" value="<?php echo $lang['general']['bestel']; ?>" />
            </div>
*door te bestellen ga je akkoord met de <A HREF="./?file=algemene-voorwaarden">algemene voorwaarden</A>
        </form>
    <?php

}
?>

Reactie op mijn vraag schreef:You added some new inputs.

So for each new imput you must add new code.

For example - you addd bestelpagina_postcode input.

So add:
Code:
if (isset($_POST['bestelpagina_postcode ']))
        $postcode = $_POST['bestelpagina_postcode '];

Code:
$postcode = sanitize($postcode);

Now find line:
Code:
if (mail(EMAIL, $lang['bestelpagina']['email_title'].$name, '<html><body>'.$message.'</body></html>', 'From: '.$sender."\n".'Content-type: text/html; charset=utf-8'))

and add your $postcode to this line to send postcode with email. For example (part of code above):
Code:
<html><body>Message:'.$message.'<br>Postcode'.$postcode.'</body></html>

And thats all - you have to add code fore each new imput you have added.

And about dropdown list - read about select and option tag (those are html tags).

A_Bach

Eventuele beloning valt te overleggen
 
  




Leden die dit momenteel bekijken: 1 gast(en)