Как всплыть в том же окне?

0

Я установил <form action="sendemail.php">. sendemail.php код написан в sendemail.php. Проблема в том, что я хочу, чтобы сообщение о статусе всплыло в том же окне, скажем contact.html. Он не должен открывать новое окно, в котором говорится:

"Спасибо, что обратились к нам. Как можно раньше мы свяжемся с вами"

Это новое пустое окно с этим сообщением ^^^^.


header('Content-type: application/json');
$status = ("Thank you for contacting us. As early as possible  we will contact you"
);


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

$email_from = $email;
$email_to = '[email protected]';

$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Product Id: ' . $product_id . "\n\n" . 'Contact Number: ' . $phonenumber . "\n\n" .'Quantity: ' . $quantity . "\n\n" .'Subject: ' . $subject . "\n\n" . 'Complete Address: ' . $message ."\n\n";

$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');

echo json_encode($status);
die;
Теги:
forms
popup
contact

1 ответ

0

Я не уверен, почему вы делаете jSON, но если jSON не требуется:

<?php
$name           =   @trim(stripslashes($_POST['name'])); 
$email          =   @trim(stripslashes($_POST['email'])); 
$product_id     =   @trim(stripslashes($_POST['product_id']));
$phonenumber    =   @trim(stripslashes($_POST['phonenumber']));
$quantity       =   @trim(stripslashes($_POST['quantity']));
$subject        =   @trim(stripslashes($_POST['subject'])); 
$message        =   @trim(stripslashes($_POST['message'])); 

$email_from     =   $email;
$email_to       =   '[email protected]';

$body           =   'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Product Id: ' . $product_id . "\n\n" . 'Contact Number: ' . $phonenumber . "\n\n" .'Quantity: ' . $quantity . "\n\n" .'Subject: ' . $subject . "\n\n" . 'Complete Address: ' . $message ."\n\n";

// If main processes successfully, then continue with message    
if(@mail($email_to, $subject, $body, 'From: <'.$email_from.'>')) { ?>
    <!-- Just write normally -->
    Thank you for contacting us. As early as possible  we will contact you.
<?php die; } ?>

Ещё вопросы

Сообщество Overcoder
Наверх
Меню