Jump to content

Unrecognized

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Unrecognized

  1. Hello everyone,

     

    A while back, I used a online tool which helped me to structure my CSS.

    What I mean is, I had 1 huge line of CSS code and wanted to be below eachother.

     

    1 line example:

    body,html{width:100%;height:100%;margin:0;padding:0}.page-preloader{top:0;left:0;z-index:999;position:fixed;height:100%;width:100%;text-align:center}
    

    Below eachother example:

    body,html{
      width:100%;
      height:100%;
      margin:0;
      padding:0
    }
    .page-preloader{
      top:0;
      left:0;
      z-index:999;
      position:fixed;
      height:100%;
      width:100%;
      text-align:center
    }
    

    This is what I want, but the code is way too long to do it all with backspaces and returns.

    So my question is, does anyone know a tool for this because I forgot which tool I used and how it was called.

     

    Thanks for helping me out!

     

    Kind regards,

     

    Dion.

  2. Hello Beckyking,

     

    The form I created wasn't sending any emails, so I had the same problem.

    In my case there was something wrong with a JavaScript thingy, it started sending emails when I removed the JavaScript part.

     

    Do you use any JavaScript with your contact form?

     

    Kind regards,

     

    Dion.

  3. Yes, that Javascript is intercepting the form submission. If it was programmed properly then it would allow the e-mail to be sent without reloading the page. Removing it will make the form work but it will load mailer.php into the browser.

     

    Indeed, I'm looking for a way to stop that. Not sure how I'm going to do that yet as I'm not very good in JavaScript.

  4. I somehow fixed it by removed this little JavaScript code:

    //Ajax contact
    	var form = $('.contact-form');
    	form.submit(function () {
    		$this = $(this);
    		$.post($(this).attr('action'), function(data) {
    			$this.prev().text(data.message).fadeIn().delay(3000).fadeOut();
    		},'json');
    		return false;
    	});
    

    I added a email input into my form and uploaded it to my webhost. Tried the form out and it worked perfect, it actually sends the details to my email address right now.

     

    Thank you all for the patience, kindness and help!

  5. It's sending a POST request but not sending any of the form's fields.

     

    Do you know Javascript?

     

    I tried learning JavaScript, but I didn't had the same amount of interest in JavaScript as in HTML and CSS. That's the sad part, maybe this is a good thing so I'll go and learn JavaScript.

  6. I'm using a template which had the JSON thing already in this file, so I didn't remove it because I didn't understand it fully.

     

    There is actually a couple JavaScript files added to my website, but only 1 were I could find something about the contact form.

    This is the part I found in the JavaScript which is about the contact form:

    //Ajax contact
    	var form = $('.contact-form');
    	form.submit(function () {
    		$this = $(this);
    		$.post($(this).attr('action'), function(data) {
    			$this.prev().text(data.message).fadeIn().delay(3000).fadeOut();
    		},'json');
    		return false;
    	});
    
  7. The echo statement isn't necessary, but it will still work the same. When you submit the form information should be displayed on the page, look at it carefully to see if it matches what you expected to see.

     

    You could just var_dump($_POST) as well.

     

    Once again, I'm not sure if I'm doing it right. I tried the following:

    <?php
    	header('Content-type: application/json');
    	$status = array(
    		'type' => 'success',
    		'message' => 'Email sent!'
    	);
    	
    	$name = trim(stripslashes($_POST['name']));
    	$email = trim(stripslashes($_POST['email']));
    	$subject = trim(stripslashes($_POST['subject']));
    	$message = trim(stripslashes($_POST['message']));
    	echo var_dump($_POST);
    	
    	$email_from = 'info@dioncreations.com';
    	$email_to = 'info@dioncreations.com';
    	
    	$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
    	
    	$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
    	
    	echo json_encode($status);
    	die;
    ?>
    

    I tried it without the echo and the form didn't work anymore so I added the echo again.

    When I went to the index.html and tried sending the form it didn't gave me a "Email sent!" message anymore but I had an email still without any content only the name, subject, email and message.

    So I tried going to my mailer.php file instead of going to my index.html and had the same email in my inbox but the PHP file was giving me this message:

    array(0) {}{"type":"success","message":"Email sent!"}
  8. You should remove the @ from these lines of code:

        $name = @trim(stripslashes($_POST['name']));
        $email = @trim(stripslashes($_POST['email']));
        $subject = @trim(stripslashes($_POST['subject']));
        $message = @trim(stripslashes($_POST['message']));

    If any errors are occurring there the @ operator will stop you from seeing them.

     

    I suspect your POST values are empty. Try printing out the values to see what you're getting. If you use var_dump() on the values you'll see more information about the content of the variables.

     

    I hope I understood you right and I tried the following:

    	$name = trim(stripslashes($_POST['name']));
    	$email = trim(stripslashes($_POST['email']));
    	$subject = trim(stripslashes($_POST['subject']));
    	$message = trim(stripslashes($_POST['message']));
    	echo var_dump($name, $email, $subject, $message);
    
  9. Are you receiving the e-mails or not?

     

    The code seems fine to me. You should update $status based on the value of $success so that you can tell if the mail was properly sent or not.

     

    I do receive the emails now but they are empty and I've no clue how to fix it. The only thing I'll get is:

     

    Name:

    Email:

    Subject:

    Message:

     

    And the subject is also empty.

  10. Hello everyone,

     

    I'm having some trouble with fixing my contact form, it doesn't send any details to my email address.

    The form I made is coded in HTML and I use PHP to send the details away.

     

    I contacted the hosting company of my website and they said the following:

    "Mail with another sender than the domain from which it got sended is unfortunately not possible anymore, the mail which will be send from dioncreations.com has to be a @dioncreations.com address. We did this because spammers abused the contact forms multiple times which gave our mail servers some difficulties."

     

    So I'm trying to fix my PHP send script so it will send the details to my email address.

     

    PHP script:

    <?php
    	header('Content-type: application/json');
    	$status = array(
    		'type' => 'success',
    		'message' => 'Email sent!'
    	);
    	
    	$name = @trim(stripslashes($_POST['name']));
    	$email = @trim(stripslashes($_POST['email']));
    	$subject = @trim(stripslashes($_POST['subject']));
    	$message = @trim(stripslashes($_POST['message']));
    	
    	$email_from = 'info@dioncreations.com';
    	$email_to = 'info@dioncreations.com';
    	
    	$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
    	
    	$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
    	
    	echo json_encode($status);
    	die;
    ?>
    

    HTML script

    <form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="mailer.php" role="form">
    	<div class="row">
    		<div class="col-sm-6">
    			<div class="form-group">
    				<input type="text" class="form-control" id="name" name="name" placeholder="Name" required="required">
    			</div>
    		</div>
    		<div class="col-sm-6">
    			<div class="form-group">
    				<input type="text" class="form-control" id="subject" name="subject" placeholder="Subject" required="required">
    			</div>
    		</div>
    	</div>
    	<div class="row">
    		<div class="col-sm-12">
    			<div class="form-group">
    				<textarea class="form-control" rows="8" id="message" name="message" placeholder="Message" required="required"></textarea>
    			</div>
    			<div class="form-group">
    				<button type="submit" class="btn btn-danger btn-lg">Send Message</button>
    			</div>
    		</div>
    	</div>
    </form>
    

    Someone told me there are variables missing, but what kind of variables he wouldn't say.

     

    Can someone help me out, so I can continue with my website?

     

    I thank you kindly! Your help is much appreciated.

×
×
  • Create New...