*Hello I was designing a form to take some value in the given fileds and return the whole as a "DRAFT"
once the user fills the form clicks copy to clipboard the whole draft has to be copied ,if he/she clicks clear button the all fields has to be cleared ...... im trying to achieve this by using javascript ! kindly guide .. very new to php
*
<?php
$accno =$_POST['accno'];
$accanme =$_POST['accname'] ;
$bankname = $_POST['bankname'] ;
$branch = $_POST['branch'] ;
$ifsc= $_POST['ifsc'] ;
if(isset($accno) && isset($accanme) && isset($bankname) && isset($branch) && isset($ifsc))
{
if(!empty($accno) && !empty($accanme) && !empty($bankname) && !empty($branch) && !empty($ifsc))
{
$ckipboardcopy = "This mail is to intimate you that the following bank details have been updated in your merchant account <strong>".$accanme. " - " ."$accno"."</strong> from our end.The details are as follows, "."<br><br>".
"Account No - "." $accno </br>".
"Account Name - "." $accanme </br>".
"Bank Name - "." $bankname </br>".
"Branch Name - "." $branch </br>".
"IFSC Code - "." $ifsc </br></br>". "Please do revert us for any further clarification on the above " ;
//echo $ckipboardcopy ;
'copyToClipboard($)' ;
}
else
{
'IsEmpty()';
}
}
?>
<html>
<script type="text/javascript">
<!-- This code is used for copying the one text value to other
function CopyIt(Which)
{
Which.formaccno.value=Which.accno.value;
Which.formaccname.value=Which.accname.value;
}
</script>
<script type="text/javascript" name ="IsEmpty()">
alert("Hey ! I wont Accept Empty Fields") ;
</script>
<script type="text/javascript">
function copyToClipboard ()
var text = <?php echo ckipboardcopy ?> ;
window.prompt ("Copy to clipboard: Ctrl+C, Enter", text);
}
</script>
<form action = "venki.php" method = "POST" >
<img src= "D:\xampp\htdocs\logo_ebs.png" DIPLAY="TRUE"> </img>
<h1> Bank Details Updation </h1> <h2 > Merchant Form </h2>
<link rel="stylesheet" type="text/css" href="blue.css">
</br></br>
<tr> This mail is to intimate you that the following bank details have been updated in your merchant account <strong>
<input type="textbox" name ="accname"> - <input type="textbox" name="accno" value="" maxlength ="5" ></strong> from our end.The details are as follows,</tr>
<input type ="checkbox" value=" Copy " onclick="CopyIt(this.form)" >
</br></br></br>
<table border="2"align ="centre">
<tr length = "20"><td length ="10"> Account No </td> <td> <input type="textbox" name="formaccno" value="" maxlength ="5" ></td> </tr>
<tr length = "20"><td length ="10"> Account Name </td> <td> <input type="textbox" name="formaccname" value="" size =" 20" ></td> </tr>
<tr length = "20"><td length ="10"> Bank Name </td> <td> <input type="textbox" name="bankname" value="" size =" 20" ></td> </tr>
<tr length = "20"><td length ="10"> Branch Name </td> <td> <input type="textbox" name="branch" value="" size =" 20" ></td> </tr>
<tr length = "20"><td length ="10"> IFSC Code </td> <td> <input type="textbox" name="ifsc" value="" size =" 20" ></td> </tr>
</table>
<input type="textbox" value="<?php echo $ckipboardcopy?>" ID="txtArea">
</br>
Please do revert us for any further clarification on the above.
</br></br></br></br>
<table>
<tr>
<td>
<input type ="button" onClick="copyToClipboard()" value="Copy to clipboard"/></td>
<td>
<input type = "submit" name="clear"/></td>
</tr>
</table>
</form>
</html>