HabboxWiki needs you!
Are you a Habbo buff? Or maybe a rare trader with a bunch of LTDs? Get involved with HabboxWiki to share your knowledge!
Join our team!
Whether you're raving for rares, excited for events or happy helping, there's something for you! Click here to apply
Need a helping hand?
Check out our guides for all things to help you make friends, make rooms, and make money!


Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2005
    Location
    Bournemouth
    Posts
    5,389
    Tokens
    2,166
    Habbo
    Meanies

    Latest Awards:

    Default Contact form help

    Okay it's been ages since I've done anything websitey and I'm getting really frustrated. When the submit button is pressed, it takes you to the php file and doesn't send the email. The codes I have are these;

    HTML file
    HTML Code:
    		<div class="article">
    			<h2>Contact me?</h2>
    			<form action="contact.php" method="POST">
    				<div class="cl"></div>
    				<div class="column-cnt">
    					<div class="cl"></div>
    					<div class="column">
    						<label for="your-name">Your Name?</label>		
    						<span class="text-field"><input type="text" id="your-name" value="" />	</span>			
    					</div>					
    					<div class="column">
    						<label for="your-email">Your E-mail address?</label>		
    						<span class="text-field"><input type="text" id="your-email" value="" /></span>				
    					</div>		
    					<div class="cl"></div>
    					<p>little bit of writing</p>											
    				</div>
    				<div class="column-big">
    					<label for="your-message">Your Message</label>		
    					<span class="text-area"><textarea id="your-message" rows="" cols=""></textarea>	</span>		
    					<a href="#">Send the message</a>
    					<input type="submit" value="Send">
    				</div>	
    				<div class="cl"></div>
    			</form>
    		</div>
    PHP file
    PHP Code:
    <?php
    $field_name 
    $_POST['your-name'];
    $field_email $_POST['your-email'];
    $field_message $_POST['your-message'];

    $mail_to 'notseeingmyemail';
    $subject 'Message from a site visitor '.$field_name;

    $body_message 'From: '.$field_name."\n";
    $body_message .= 'E-mail: '.$field_email."\n";
    $body_message .= 'Message: '.$field_message;

    $headers 'From: '.$field_email."\r\n";
    $headers .= 'Reply-To: '.$field_email."\r\n";

    $mail_status mail($mail_to$subject$body_message$headers);

    if (
    $mail_status) { ?>
        <script language="javascript" type="text/javascript">
            alert('Thank you for the message. We will contact you shortly.');
            window.location = 'contact_page.html';
        </script>
    <?php
    }
    else { 
    ?>
        <script language="javascript" type="text/javascript">
            alert('Message failed.');
            window.location = 'contact_page.html';
        </script>
    <?php
    }
    ?>

    cake


  2. #2
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Is email properly set up on the server you're using?
    Chippiewill.


  3. #3
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default

    I can't see any problems with your code, so you should double check your server settings and info.

  4. #4
    Join Date
    Jun 2005
    Location
    Bournemouth
    Posts
    5,389
    Tokens
    2,166
    Habbo
    Meanies

    Latest Awards:

    Default

    Okay I made a silly mistake and completely forgot I was working through xampp and not actually online so that is rather awkward.

    On submission, how can I take the user back to the page they were on? Or even just back to the homepage to keep it simple?

    cake


  5. #5
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default

    use the header.

    PHP Code:
    <?php
    $field_name
    =$_POST['your-name'];
    $field_email=$_POST['your-email'];
    $field_message=$_POST['your-message'];

    $mail_to='notseeingmyemail';
    $subject='Messagefromasitevisitor'.$field_name;

    $body_message='From:'.$field_name."\n";
    $body_message.='E-mail:'.$field_email."\n";
    $body_message.='Message:'.$field_message;

    $headers='From:'.$field_email."\r\n";
    $headers.='Reply-To:'.$field_email."\r\n";

    $mail_status=mail($mail_to,$subject,$body_message,$headers);

    if(
    $mail_status){?>
    <scriptlanguage="javascript"type="text/javascript">
    alert('Thankyouforthemessage.Wewillcontactyoushortly.');
    window.location='contact_page.html';
    </script>
    <?php
    header
    ('Location: ./index.php');}
    else{
    ?>
    <scriptlanguage="javascript"type="text/javascript">
    alert('Messagefailed.');
    window.location='contact_page.html';
    </script>
    <?php
    }
    ?>

  6. #6
    Join Date
    Feb 2011
    Posts
    282
    Tokens
    98

    Latest Awards:

    Default

    If your having problems with the code Just Search google For free Contact us forms etc, You can build it yourself then you get the HTML you get emails from it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •