I am working on a project that will take user input value from an HTML form and then convert such values from one base to the other. I have been trying for hours without success. I have created five Html input types. One for the number to be converted. Two for the base to be converted from. Three for the base to be converted to. Four, a text box for displaying the result and finally a button which the user will click to run the process. I will put the code below for warm assistance. Thanks all in advance.
I tried PHP isset method, !empty, settype, post but all did not work
<form method="POST" name="btnN" id="chr"class="myfm" action=" <?php htmlspecialchars($_SERVER['PHP_SELF']);?>">
<span style="color:white">From number:</span> <br><input type="text" name="screen1" ><br><br>
<span style="color:white">From base:</span> <br><input type="text" name="screen2"><br><br>
<span style="color:white">To base:</span> <br><input type="text" name="screen3"><br><br>
<span style="color:white">Result:</span> <br><input type="text" name="screen" ><br><br>
<input name="conver" type="button" value="Convert" onclick="btnN.screen.value='<?php echo $converted; ?>'" style="width:50%" >
</form>
<?php
$screen1=settype($_POST['screen1']);
$screen2= settype($_POST['screen2']);
$screen3=settype($_POST['screen3']);
do{
$screen1=settype($screen1,"integer");
$screen2=settype($screen2,"integer");
$screen3=settype($screen3,"integer");
$converted= base_convert($screen1,$screen2,$creen3);
}
while(isset($_POST['conver']));
?>
All that I want is, to have an HTML form with text boxes where the user can enter the number he or she wants to convert from a specified base to another specified base. example converting 12548 from base10 to base5. My main problem is with the PHP codes. Thanks for helping!