Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,638 members, 7,813,119 topics. Date: Tuesday, 30 April 2024 at 07:24 AM

Please Kindly Help With This JSON Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Please Kindly Help With This JSON Code (1119 Views)

Professional Html,bootstrap,php,java,json Web Deloper. Pay After Service! / Jamb Past Questions API In JSON / Programming Challenge: Convert String to Json with a Loop (2) (3) (4)

(1) (Reply) (Go Down)

Please Kindly Help With This JSON Code by ptassystems: 1:20pm On Aug 19, 2015
Am trying to code this into a contact form on a website, but its delivering an empty message. Please someone should help me check the code.

<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Thank you for contacting us. As early as possible we will contact you '
);

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

$email_from = $email;
$email_to = 'mail@email.com';//email address to receive message

$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;

?>


Thanks
Re: Please Kindly Help With This JSON Code by thewebcraft(m): 4:15pm On Aug 19, 2015
The code works, are you trying to read the json?
Re: Please Kindly Help With This JSON Code by ptassystems: 4:55pm On Aug 19, 2015
Am trying to use it on the contact page of a website, but whenever the contact form is filled, the message posted are not delivered to the mail. Only an empty message is delivered.

The Email, Name, Subject and Message sent are not delivered, just an empty mail.
Re: Please Kindly Help With This JSON Code by Nobody: 5:34pm On Aug 19, 2015
ptassystems:
Am trying to code this into a contact form on a website, but its delivering an empty message. Please someone should help me check the code.

<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Thank you for contacting us. As early as possible we will contact you '
);

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

$email_from = $email;
$email_to = 'mail@email.com';//email address to receive message

$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;

?>


Thanks
una too lyk stress .use Google form
www.nairaland.com/2536824/html-contact-form-gurus
Re: Please Kindly Help With This JSON Code by jacob05(m): 6:11pm On Aug 19, 2015
ptassystems:
Am trying to use it on the contact page of a website, but whenever the contact form is filled, the message posted are not delivered to the mail. Only an empty message is delivered.

The Email, Name, Subject and Message sent are not delivered, just an empty mail.

probably you should check your HTML form... or paste it
Re: Please Kindly Help With This JSON Code by Nobody: 10:25pm On Aug 19, 2015
When you put error surpression for the mail function nko? how are we to know what happened?

1 Like

Re: Please Kindly Help With This JSON Code by babatope88(m): 12:06am On Aug 20, 2015
Sai baba
Re: Please Kindly Help With This JSON Code by ptassystems: 3:22am On Aug 20, 2015
<div class="row contact-wrap">
<div class="status alert alert-success" style="display: none"></div>
<form id="main-contact-form" class="contact-form" name="contact-form" method="POST" action="sendemail.php">
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group">
<label>Name *</label>
<input type="text" name="name" class="form-control" required="required">
</div>
<div class="form-group">
<label>Email *</label>
<input type="email" name="email" class="form-control" required="required">
</div>
<div class="form-group">
<label>Phone *</label>
<input type="number" class="form-control">
</div>
<div class="form-group">
<label>Company Name</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-sm-5">
<div class="form-group">
<label>Subject *</label>
<input type="text" name="subject" class="form-control" required="required">
</div>
<div class="form-group">
<label>Message *</label>
<textarea name="message" id="message" required="required" class="form-control" rows="8"></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button>
</div>
</div>
</form>
</div>

This is the form. Thanks to programmers willing to help
Re: Please Kindly Help With This JSON Code by Nobody: 4:32am On Aug 20, 2015
babatope88:
Sai baba
Sai Omo!

@op, you are welcome o jare.

(1) (Reply)

How To Get The Dimensions (width And Height) Of An Image From The Image Url / Php Coders Help / Receiving Data From Wireshark In Real Time With Php

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.