Problem with Emails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rowruffdesign
Forum Newbie
Posts: 1
Joined: Wed Aug 10, 2011 1:10 pm

Problem with Emails

Post by rowruffdesign »

Ok maybe someone can help me..

I made this code but there is something missing for the mail
And i know i need to put in mail() but i dont know where and whats belong to stand between it..

I hope you guys can help me ;)

Thanks

Code: Select all

 <?php
			//init variables
			
			$to = "mail@gmail.com";		
			$subject = "Mail van iets.nl";	
			$cf = array();
			$sr = false;
			   			
			if(isset($_SESSION['cf_returndata'])){
				$cf = $_SESSION['cf_returndata'];
			 	$sr = true;
						
			}
            ?>
            <ul id="errors" class="<?php echo ($sr && !$cf['form_ok']) ? 'visible' : ''; ?>">
                <li id="info">Er zijn problemen met het versturen van uw bericht</li>
                <?php 
				if(isset($cf['errors']) && count($cf['errors']) > 0) :
					foreach($cf['errors'] as $error) :
				?>
                <li><?php echo $error ?></li>
                <?php
					endforeach;
				endif;
				?>
            </ul>
            <p id="success" class="<?php echo ($sr && $cf['form_ok']) ? 'visible' : ''; ?>">Bedankt voor uw bericht</p>
            <form method="post" action="process.php">
                <label for="name">Naam: <span class="required">*</span></label>
                <input type="text" id="name" name="name" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['name'] : '' ?>" placeholder="Andre Maassen" required autofocus />
                
                <label for="email">Emailadres: <span class="required">*</span></label>
                <input type="email" id="email" name="email" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['email'] : '' ?>" placeholder="123@mail.com" required />
                
                <label for="telephone">Telefoon: </label>
                <input type="tel" id="telephone" name="telephone" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['telephone'] : '' ?>" />
                
                <label for="message">Bericht: <span class="required">*</span></label>
                <textarea id="message" name="message" placeholder="Typ hier uw bericht" required data-minlength="0"><?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['message'] : '' ?></textarea>
                
                <span id="loading"></span>
                <input type="submit" value="Verstuur" id="submit-button" />
                <p id="req-field-desc"><span class="required">*</span>een verplicht veld</p>
            </form>
            <?php unset($_SESSION['cf_returndata']); ?>
Dodon
Forum Commoner
Posts: 64
Joined: Wed Aug 03, 2011 4:11 am
Location: Netherlands

Re: Problem with Emails

Post by Dodon »

Your form gets send to process.php so you have to place the mail() function there.

On how to use it: here is a link
Post Reply