What is the HTML for that?

What is the html for this php sms sending code I has tried my end but not success hope you all guys help us.

<?php

//Your authentication key
$authKey = "YourAuthKey";

//Multiple mobiles numbers separated by comma
$mobileNumber = "9999999";

//Sender ID,While using route4 sender id should be 6 characters long.
$senderId = "102234";

//Your message to send, Add URL encoding here.
$message = urlencode("Test message");

//Define route 
$route = "default";
//Prepare you post parameters
$postData = array(
    'authkey' => $authKey,
    'mobiles' => $mobileNumber,
    'message' => $message,
    'sender' => $senderId,
    'route' => $route
);

//API URL
$url="http://api.msg91.com/api/sendhttp.php";

// init the resource
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $postData
    //,CURLOPT_FOLLOWLOCATION => true
));


//Ignore SSL certificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);


//get response
$output = curl_exec($ch);

//Print error if any
if(curl_errno($ch))
{
    echo 'error:' . curl_error($ch);
}

curl_close($ch);

echo $output;
?>

Obviously speaking. It’s this.

Whatever cURL obtains is what you get as output (HTML).

Actually I copy this code from my bulk sms sending website. This php is use for send sms. I want create this code body bone. It means I want make front look to the help of html. Basically I know html but I don’t know how I instigate with php.

I wish if any send sms he can see “SMS SENT SUCCESSFULLY” Confirmation.

Body look like:
[MOBILE NUMBER]
[NAME]
[TEXTAREA]
[SEND: BUTTON]

OUTPUT IN MY SMS INBOX :slight_smile:
Like;
[NAMR], [MOBILE NUMBER]
['TEXTAREA MSG]

]PLS HELP

What do you have so far besides a template for someone to make for you?

I am not understand…

Why I am not get message if anyone fill up this…
PHP handler (mail_handler.php)
(Uses info from HTML form and sends the Email)

<?php 
if(isset($_POST['submit'])){
    $to = "email@example.com"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    // You cannot use header and echo together. It's one or the other.
    }
?>

HTML

<!DOCTYPE html>
<head>
<title>Form submission</title>
</head>
<body>

<form action="mail_handler.php" method="post">
First Name: <input type="text" name="first_name"><br>
Last Name: <input type="text" name="last_name"><br>
Email: <input type="text" name="email"><br>
Message:<br><textarea rows="5" name="message" cols="30"></textarea><br>
<input type="submit" name="submit" value="Submit">
</form>

</body>
</html>

it is working. try it in your page

No working becouse when I was change this form in :

<table width="100%" cellspacing="10">
                    <tr>
                        <td width="27%" align="right" style="font-size: 12px; color: #000;">
                            <strong>Email ID</strong>
                        </td>
                        <td colspan="2" align="left">
                            
                            <input name=Email" type="email" maxlength="25" class="loginInputbox" oncopy="return false" onpaste="return false" oncontextmenu="return false;"/>
                            </td>
                    </tr>
                    <tr>
                        <td align="right" style="font-size: 12px; color: #000;">
                            <strong>Mobile No.</strong>
                        </td>
                        <td colspan="2" align="left">
                        
                            
                            <input name="Mobile" type="tel" maxlength="10" class="loginInputbox"  oncopy="return false" onpaste="return false" oncontextmenu="return false;" />
                             </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="right" style="font-size: 10px; width: 50%">
                            <table>
                                <tr>
                                    <td>
                                       <span>
                                            <a href="#">Register New user</a>
                                            |<a href="#">
                                            Contact&nbsp;Us &nbsp;&nbsp;&nbsp;&nbsp;</a></span>
                                    </td>
                                    <td>
                                        <table border="0" cellspacing="0" cellpadding="0" class="btn">
                                            <tr>
                                                <td width="90" align="center" valign="middle">
                         
                                                    <input type="submit" name="submit" value="Submit"></form>
</form>

Mail_hand.php

<?php 
if(isset($_POST['submit'])){
    $to = "info@example.com"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $Mobile = $_POST['Mobile'];
    $Email = $_POST['Email'];
    $subject = "WebSMS";
    $subject2 = "Copy of your form submission";
    $message = $Mobile . " " . $Email . " wrote the following:" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $Mobile . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    echo "Mail Sent. Thank you " . $Mobile. ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    // You cannot use header and echo together. It's one or the other.
    }
?>

Then it not work if you have power then make it correct and reply…

As I’ve already explained in your other thread, that HTML is invalid. You cannot expect invalid code to work correctly.

Same I said you that If I don’t know please correct… You know @TechnoBear you always suggested me but you never help to correct my codes …

Please don’t think negative… but this is true…

@TechnoBear you know you have knowledge to change this and make this correct but I have not… I am not any software developer and any engineer normally I am a student of math but I like to play with codes in free time…Not free time mainly max times…

Thanks…

I’ll be happy to help.
Start by putting your HTML into the validator and post back the first error message it gives that you don’t understand how to fix.

As I said in your other thread, we are here to help you learn, NOT write your code for you.

2 Likes

That’s because I’m trying to help you. If I correct your code, you won’t learn anything, and next time you have a similar problem you will have to ask for help again. If you learn how to find and correct your own mistakes, then you have learned a useful skill for the future.

So, as we’ve suggested many times, use the https://validator.w3.org to find problems and fix them. The only alternative that I know of is for you to go through your code and check manually that every attribute has both opening and closing quotations marks (that’s a hint) and that every opening tag has an appropriately-positioned closing tag (that’s another hint). If you use an HTML editor, the colour coding should show immediately when there is a problem, and you should be able to match tag pairs.

The other reason that I won’t fix your code is because you are insisting on using HTML <table> tags in a way which has not been appropriate for many years. This has also been explained to you. If you want to use outdated methods, then that’s your problem; I’m not writing bad code for you, just to save you the trouble of learning good coding practices.

6 Likes

Never use the mail() function. This function has strange behaviors at times and even a correctly written one can still fail at times. Use something like PHPMailer or swiftMailer.

2 Likes

@spaceshiptrooper could you please write full code?

I am sorry, but this is not a free coding service. This is a forum. A forum is there to help people with specific problems who have already done some of their own work.

6 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.