Results 1 to 3 of 3

Thread: How to give a variable into the value of hidden fields
      
   

  1. #1
    zhaohx02 is offline Staff Sergeant
    Join Date
    Apr 2010
    Posts
    42

    Default 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. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default 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!


  3. #3
    zhaohx02 is offline Staff Sergeant
    Join Date
    Apr 2010
    Posts
    42

    Default Re: How to give a variable into the value of hidden fields

    It works.
    Thank you very much.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49