<?php
   $a="";
   $b="";
   $c="";
   if(isset($_GET["plus"]))
   {
       $a=$_GET['eknum'];
       $b=$_GET['donum'];
       $c=$a+$b;
   }
   ?>
       <form action="index.php" method="GET">
            <input type="text"  name="eknum" value="
                   <?php
                    echo "$a";  ?> " />
            <br> 
            <input type="text"  name="donum" value="
                   <?php echo $b;  ?>
                   " />
            <br> 
            <input type="text"  name="execute" 
                   value="
                   <?php echo $c;        ?>
                   " />

             <input type="submit" value="sum" name="plus">

            </form>

if the text in your input elemnets is being aligned in the center, that means you have some style that is being applied either to the input elements either directly or being inherited somehow.

Just apply the { text-align: left } property to your input elements. For example..

form input { text-align: left }
<input type="text"  name="donum" value="
               <?php echo $b;  ?>
               " />

The above adds unnecessary spaces to your input. Try:

<input type="text" name="donum" value="<?php echo $b; ?>" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.