Announcement

Collapse
No announcement yet.

How to give a variable into the value of hidden fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to give a variable into the value of hidden fields

    Hello.
    I add a hidden fields in the form, I want the value of the hidden filels to get a variable, the varialbe is a username, so I composing the script:

    <form name="form_userprofile" method="POST" action="http://www.yayalearn.com/ABVFP/dbts_abvfp.php" enctype="multipart/form-data" id="Form1"
    <?php
    $membername=$_SESSION['username'];
    ?>
    <input type="hidden" name="f0_username" value='$membername'>
    <input type="hidden" name="Formid" value="2">

    but when I check the table in my SQL database, the hidden fields "f0_username" value is "NULL" .

    Please help me.
    Thanks
    Lucy

  • #2
    Re: How to give a variable into the value of hidden fields

    <form name="form_userprofile" method="POST" action="http://www.yayalearn.com/ABVFP/dbts_abvfp.php" enctype="multipart/form-data" id="Form1"
    <input type="hidden" name="f0_username" value="<?php echo $_SESSION['username'];?>">
    <input type="hidden" name="Formid" value="2">

    In other words, just give your hidden field the value

    <?php echo $_SESSION['username'];?>

    Of course this requires that you have already started a session. This is automatic if you have added in your page the Page Protect object.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment


    • #3
      Re: How to give a variable into the value of hidden fields

      It works.
      Thank you very much.

      Comment

      Working...
      X