How to refer from one variable to hidden variable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hjyn

    How to refer from one variable to hidden variable?

    Hi All,

    I have started with my php source code shown below, and how can I
    refer from one var to hidden var?

    ----------------------------------------------------------------------------
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
    {
    $insertSQL = sprintf("INSERT INTO users (UserID, UserName, Password)
    VALUES (%s, %s, %s)",
    GetSQLValueStri ng($_POST['UserID'], "int"),
    GetSQLValueStri ng($_POST['UserName'], "text"),
    GetSQLValueStri ng($_POST['Password'], "text"));

    mysql_select_db ($database_SHHC onnection, $SHHConnection) ;
    $Result1 = mysql_query($in sertSQL, $SHHConnection) or
    die(mysql_error ());
    }

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
    {
    $insertSQL = sprintf("INSERT INTO holidaymaker (HMID, Name, Status)
    VALUES (%s, %s, %s)",

    GetSQLValueStri ng($_POST['HMID'], "int"),
    GetSQLValueStri ng($_POST['Name'], "text"),
    GetSQLValueStri ng($_POST['Status'], "text"));

    mysql_select_db ($database_SHHC onnection, $SHHConnection) ;
    $Result1 = mysql_query($in sertSQL, $SHHConnection) or
    die(mysql_error ());
    }

    <input type="hidden" name="UserID" value="">
    <input type="hidden" name="HMID" value= "">

    ----------------------------------------------------------------------------

    The "UserID" is generated by MySql with auto_increment.[color=blue]
    >UserID int(4) auto_increment primary key,[/color]

    Assume that I want to add new user and the value for UserID is 5
    (after auto increment). Then, I want HMID refer to UserID, the value
    of HMID is also 5,
    thats mean HMID = UserID, how can I do that? What is the command?


    Thanks.


    Best Regards,
    Hau Jyn
Working...