Friday 8 April 2022

Send Whatapp message from contact form | PHP

 

PHP Code

<?php

if(isset($_POST['submit']))
{

 

$str="https://wa.me/+91-9795000000?text=";

$str.="Roll%20:%20" . preg_replace('/ /','%20',$_POST['Roll']);

$str.= ",Name%20:%20. preg_replace('/ /','%20',$_POST['Name']);

$str.=",City%20:%20" . preg_replace('/ /','%20',$_POST['City']);

header("Location: $str");
}

?>          


HTML

<form method="post" style="margin:4%">

 

    <input type="text" name="Roll" /><br />

    <input type="text" name="Name" /><br />

    <input type="text" name="City" /><br />

    <input type="submit" name="submit" value="Send" />

 

</form>