PHP help

chint

Well-known member
  • Oct 3, 2007
    16,235
    408
    83
    cgtech.lk
    Me html and php code wala thiyena aula mokada kiyala danna kenek kiyanawad?:(

    THIS THE ERROR
    ( ! ) Notice: Undefined index: nme in C:\wamp\www\new\new.php on line 9
    Call Stack
    # Time Memory Function Location
    1 0.0013 365056 {main}( ) ..\new.php:0
    Thank you
    Name:

    HTML:
    <html>
    <body>
    <form name="f1" mathod="POST" action="http://localhost/new/new.php">
    <h1>Magazine Subscription</h1>
    Name:
    <input type="text" name="nme"/>
    <br>
    Telephone:
    <input type="text" name="tp"/>
    <br>
    Subscription Durration:
    <select name="sub">
    <option value="1" selected>One Month</option> 
    <option value="6">Six Months</option> 
    <option value="12">One Year</option>
    </select> 
    <br>
    Do you like susccribe to our newsletter?
    <input type="radio" name="rd" value=1/>yes
    <input type="radio" name="rd" value=2/>no
    
    <br>
    <input type="submit" value="Send"/>
    <input type="reset" value="Cancel"/>
    </form>
    
    </body>
    </html>

    PHP:
    <html>
    <body>
    
    
    <?php
    $name=$_POST["nme"];
    echo"Thank you ";
    ?>
    
    <table border="1">
    <tr><th>Name:</th><td>
    <?php 
    echo "$name"; 
    ?>
    </td></tr>
    </table>
    
    </body>
    </html>
     

    chint

    Well-known member
  • Oct 3, 2007
    16,235
    408
    83
    cgtech.lk
    ube form eke method wenuwata tiyenne mathod kiyala ekai awula.;)

    :baffled::baffled:
    hapoi
    Head-Bang.bmp
     

    lankanBoy

    Active member
  • Jul 20, 2011
    801
    56
    28
    <html>
    <body>
    <form name="f1" method="POST" action="http://localhost:8080/test/new.php">
    <h1>Magazine Subscription</h1>
    Name:
    <input type="text" name="nme"/>
    <br>
    Telephone:
    <input type="text" name="tp"/>
    <br>
    Subscription Durration:
    <select name="sub">
    <option value="1" selected>One Month</option>
    <option value="6">Six Months</option>
    <option value="12">One Year</option>
    </select>
    <br>
    Do you like susccribe to our newsletter?
    <input type="radio" name="rd" value=1/>yes
    <input type="radio" name="rd" value=2/>no

    <br>
    <input type="submit" value="Send"/>
    <input type="reset" value="Cancel"/>
    </form>

    </body>
    </html>


    php------------------------------------

    <html>
    <body>


    <?php

    $name=$_POST['nme'];
    echo"Thank you ";

    ?>

    <table border="1">
    <tr><th>Name:</th>
    <?php
    echo "<td>";
    echo $name;
    echo "</td>";
    ?>
    </tr>
    </table>

    </body>
    </html>
     
    • Like
    Reactions: chint