Hi.
I have a PHP script on a form.
It generates a mailto command with lots of variables pulled from the form fields.
The only problem with it is that if someone types &, % or ; in the fields then it will only generate the email up to that character, the rest is missing.
I've done a little researched and im not sure but maybe htmlspecialchars could be a solution?
I'm not 100% what to do, but it is vital I get this right ASAP.
I hope you can help.
<?php
if(isset($_POST['imtform_submit']) && $_POST['imtform_pass'] == "xxxxxx" && isset($_POST['imtform_upd'])) {
// Get Variables from form
$imtform_summary = $_POST['imtform_summary'];
$imtform_ref = $_POST['imtform_ref'];
$imtform_cate = $_POST['imtform_cate'];
$imtform_type = $_POST['imtform_type'];
$imtform_item = $_POST['imtform_item'];
$imtform_grp = $_POST['imtform_grp'];
$imtform_pass = $_POST['imtform_pass'];
$imtform_upd = $_POST['imtform_upd'];
$imtform_agnt = $_POST['imtform_agnt'];
// Update frontend IMT Shout
$File = "../matt/inc/imt.txt";
$fh = fopen($File, 'w') or die("can't open file");
fwrite($fh, $_POST['imtform_summary']) or die("can't write file");
fclose($fh);
// Generate and open email
print "<meta http-equiv='refresh' target='_PARENT 'content='0;URL=mailto:<email recepients>&subject=UPDATE: ".$imtform_summary." - ".$imtform_ref."&body=The following Master Ticket has been created to link all calls to:%0A%0A".$imtform_summary."%0A%0ACategory - ".$imtform_cate."%0AType - ".$imtform_type."%0AItem - ".$imtform_item."%0A%0ARemedy Reference - ".$imtform_ref."%0A%0AThis is currently logged with ".$imtform_grp."%0A%0A,<certain team> are aware.%0A%0AThis is an update.%0AUpdate Notes: '/>";
?>
<form action="#" method="POST">
IMT Ticket Summary<br/><input class="form_box" type="text" name="imtform_summary" size="30"/><br />
Ticket Reference<br/><input class="form_box" type="text" name="imtform_ref" size="20"/><br />
Ticket Category<br/><input class="form_box" type="text" name="imtform_cate" size="30"/><br />
Ticket Type<br/><input class="form_box" type="text" name="imtform_type" size="30"/><br />
Ticket Item<br/><input class="form_box" type="text" name="imtform_item" size="30"/><br />
Ticket Group<br/><input class="form_box" type="text" name="imtform_grp" size="30"/><br />
Agent Name<br/>
<select name="imtform_agnt">
i removed this
</select><br/>
Agent Password<br/><input class="form_box" type="password" name="imtform_pass" size="20"/><br />
Is this an update?<input type="checkbox" name="imtform_upd"/><br>
<input class="form_box" type="submit" name="imtform_submit" value="Submit IMT & Open Email" Email" size="30"/>
</form>