I am making a page for email where user selects data from a drop down list. I need to add 4 entries (email,server, type & port) to a file.
I have a submit after 1st two entries then i use java to run the remaining part.
Software works partly fine (it writes all data required), The first two entries are added correctly to file, it enters a blank line (not wanted) plus port ( not wanted) correctly adds type an additional blank line (not required) then correctly adds the port data.
Is an alternative method possible ?
div>
<form method='GET'>
<label for='type'><b>Receive Type:</b></label>
<select name ='type' id='type' onchange="mytype()">
<option value='' selected>Select</option>
<option value='POP' >POP </option>
<option value='IMAP'>IMAP</option>
</select>
<script>
function mytype()
{
var x = document.getElementById("type").value;
window.location.href = "mail_recv.php?Type="+x ;
}
</script>
<?php
$type=$_GET['Type'];
fwrite($mail, $type);
?>
</div>
<div>
<form method='GET'>
<label for='port'><b>Receive Port:</b></label>
<select name ='port' id='port' onchange='myport()'>
<?php
if($type==='POP') {
echo "<option value='' selected>Select</option>";
echo "<option value=Default:110>Default:110</option>";
echo "<option value=TLS:995>TLS:995</option>";
echo "</select>";
}elseif($type==='IMAP') {
echo "<option value='' selected>Select</option>";
echo "<option value=Default:143>Default:143</option>";
echo "<option value=TLS:993>TLS:993</option>";
echo "</select>";
echo "</div>";
}else {
echo "<option value='' selected>Select</option>";
}
?>
<script>
function myport()
{
var y = document.getElementById("port").value;
window.location.href = "mail_recv.php?Port="+y ;
}
</script>
<?php
$port=$_GET['Port'];
fwrite($mail, $port);
fclose($mail);