How do I insert a session variable into a record?

I can’t figure out how to insert the value passed by a
session variable into a record.
I have a form I want to use to insert a record. I pass
session variables to this page and want to insert one of them into
the record. The session information is:
session_start();
$_SESSION['usename'] = $_POST['username'];
$idvar = $_SESSION['id'];
$_SESSION[‘id’] is the user_id that I want to
insert into the record.
I know $idvar is getting to the page with the form because I
can echo it.
The insert code looks like this:
if ((isset($_POST["MM_insert"])) &&
($_POST["MM_insert"] == "register")) {
$insertSQL = sprintf("INSERT INTO h_genres (user_id,
username, contrib_to, Advertising, Annual_Reports, Leader_Content,
Member_Content, Brochures) VALUES (%s, %s, %s, %s, %s, %s, %s,
%s)",
GetSQLValueString($_POST['user_id'], "int"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['contrib_to'], "text"),
GetSQLValueString(isset($_POST['Advertising']) ? "true" :
"", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Annual_Reports']) ? "true" :
"", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Leader_Content']) ? "true" :
"", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Member_Content']) ? "true" :
"", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Brochures']) ? "true" : "",
"defined","'Y'","'N'"));
mysql_select_db($database_hauw, $hauw);
$Result1 = mysql_query($insertSQL, $hauw) or
die(mysql_error());
I have a hidden field for the user_id:
<input name="user_id" type="hidden" id="user_id" />
I think I need to get the value in $idvar into user_id but I
don’t know how.
Any help is appreciated.

awsweb wrote:
> I have a hidden field for the user_id:
> <input name="user_id" type="hidden" id="user_id"
/>
>
> I think I need to get the value in $idvar into user_id
but I don?t know how.
<input name="user_id" type="hidden" id="user_id"
value="<?php echo
$idvar; ?>" />
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/

Similar Messages

  • How to generate a random session variable in php

    i want to generate a random session variable and insert the variable in a mysql record to use later to validate an account set up.
    person fills out form to create account and submits; inserts form information in mysql record.
    i want the random variable to be inserted from a hidden field and the page sends an email with a link to click on to compare the variable to validate the user.
    Not sure how to generate a random session variable and get that to the hidden field value to be inserted with the other form information.
    thanks for your help,
    Jim Balthrop

    To insert the key I would personally do something like...
    $key = md5($username . $password . $salt);
    Insert that into your MySQL database, then send them a email with it, my next code shows how to activate it.
    This is to activate the account.
    <?php
    $key;
    $errors = array();
    if(isset($_GET['key']){
         $key = $_GET['key'];
         $sql = 'SELECT * FROM users WHERE key = \'' . $key '\' LIMIT 1';
         $result = mysql_query($sql) or die(mysql_error());
         if(mysql_num_rows($result)){
              $sql2 = 'UPDATE users SET active = 1 WHERE key = \'' . $key '\' LIMIT 1';
              $result2 = mysql_query($sql2) or die(mysql_error());
              if($result2){
                   //successfully activated account
              else{
                   //Something Went Wrong!
         else{
              $errors[] = 'Invaild Key, Please try again!';
    else{
         $errors[] = 'Invaild Key, Please try again!';
    ?>

  • How do I insert my Edge Animation into Wordpress as an animated/interactive graphic

    How do I insert my Edge Animation into Wordpress as an animated/interactive graphic?

    Hi ColleenSyron,
    Can you check out this video: http://tv.adobe.com/watch/create-like-crazy-with-adobe-edge/episode-5-spice-up-your-wordpr ess-site-with-edge-animate/
    Thanks,
    Preran

  • How to SIMPLY use the %DIMENSION_TO_SET% variables into logic scripts

    hello,
    I'm using a prompt of type "COPYMOVE" or "COPYMOVEINPUT". In this type of prompt, there are 2 columns of dimension members list, one for defining the "source zone" and one for defining the "target zone" of logics.
    The left colum of the prompt (for source zone) feeds the variables %DIMENSION_SET% : %ACCOUNT_SET%, %ENTITY_SET%, %CATEGORY_SET%, etc...and these variables can be used in the logic scripts in *XDIM_MEMBERSET instructions for example.
    The right colum of the prompt feeds the variables %DIMENSION_TO_SET% : %ACCOUNT_TO_SET%, %ENTITY_TO_SET%, %CATEGORY_TO_SET%, etc...and I don't know how to SIMPLY use these variables in the logic scripts.
    I've found a tricky way to do that but I meet 2 problems :
    - it is complicated
    - the multi-info instruction (BEGININFO/ENDINFO) seems to be bugged as blank lines are added all the time in the code and sometimes I have to wait for minutes when I try to modifiy the package code through BPC for excel eData/modify package menu.
    So the question is how to SIMPLY get the %DIMENSION_TO_SET% variables into logic scripts and use them ? Thanks, R.
    Here is the tricky package code I use at this time (I build one function for each %DIMENSION_TO_SET% variable and I pass these functions to the logic) :
    PROMPT(COPYMOVE,,,,"ACCDETAIL,ACCOUNT,CATEGORY,DATASRC,ENTITY,TIME,YEARS")
    TASK(Execute formulas,USER,WS-WW\PlauchuR)
    TASK(Execute formulas,APPSET,US)
    TASK(Execute formulas,APP,SV)
    TASK(Execute formulas,SELECTION,D:\BPC\Data\WebFolders\US\SV\PrivatePublications\PlauchuR\TempFiles\FROM_1561_.TMP)
    TASK(Execute formulas,TOSELECTION,D:\BPC\Data\WebFolders\US\SV\PrivatePublications\PlauchuR\TempFiles\TO_1561_.TMP)
    BEGININFO(%FSS%)
    *FUNCTION TARGETACCDETAIL=%ACCDETAIL_TO_SET%
    *FUNCTION TARGETACCOUNT=%ACCOUNT_TO_SET%
    *FUNCTION TARGETCATEGORY=%CATEGORY_TO_SET%
    *FUNCTION TARGETDATASRC=%DATASRC_TO_SET%
    *FUNCTION TARGETENTITY=%ENTITY_TO_SET%
    *FUNCTION TARGETTIME=%TIME_TO_SET%
    *FUNCTION TARGETYEARS=%YEARS_TO_SET%
    ENDINFO
    TASK(Execute formulas,FORMULASCRIPT,%FSS%)
    TASK(Execute formulas,LOGICFILE,D:\BPC\Data\WebFolders\US\SV
    ..\AdminApp\SV\_TEST.Lgf)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    Edited by: ALEXANDRE BEDIER on Jun 16, 2010 3:15 PM

    hello,
    finally I've discovered that there is no need of BEGININFO instruction.
    One can pass several functions to a logic with one FORMULASCRIPT task. The functions definitions have to be separated by instructions. See below :
    PROMPT(COPYMOVEINPUT,%FTARGETS%,,"select source and target zone for category and datasource.","ACCDETAIL,ACCOUNT,CATEGORY,DATASRC,ENTITY,TIME,YEARS")
    TASK(Execute formulas,FORMULASCRIPT,*FUNCTION TACCDETAIL=%ACCDETAIL_TO_SET% *FUNCTION TACCOUNT=%ACCOUNT_TO_SET% *FUNCTION TCATEGORY=%CATEGORY_TO_SET% *FUNCTION TDATASRC=%DATASRC_TO_SET% *FUNCTION TENTITY=%ENTITY_TO_SET% *FUNCTION TTIME=%TIME_TO_SET% *FUNCTION TYEARS=%YEARS_TO_SET%)
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,%APP%)
    TASK(Execute formulas,SELECTION,%SELECTIONFILE%)
    TASK(Execute formulas,LOGICFILE,%APPPATH%\..\AdminApp\%APP%\_TEST.LGF)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    Then one will be able to use the functions TACCDETAIL, TCATEGORY, TACCOUNT,... in the logic script.
    Edited by: ALEXANDRE BEDIER on Jun 24, 2010 10:31 AM
    Edited by: ALEXANDRE BEDIER on Jun 24, 2010 10:33 AM

  • I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I've gotten a little further on this. The dynamic select is
    working fine. It's the "a href" code that isn't. I'm wondering if
    someone can look at this line and tell me if it's okay to build the
    query string this way. The storeid comes through fine but I'm still
    not getting the employeeid value to pass. Here's line that's not
    working:
    td><a href="registerStoreCust.php?storeid=<?php echo
    $row_storeRS['storeid']; echo "&employeeid="; echo
    $_GET['employeeLM']; ?>">Register
    Customer</a></td>

  • How can I insert an existing ApDiv into a tab in the Spry Tabbed Panel?

    I have 5 of them all containing nested Apdiv within nested ApDivs (a long storie ) that I would like to insert into 5 tabs in the Spry Tabbed Panel.
    Please help.

    "Hi Gramp,I realize I have made hard work for myself but I really don't know any better. I also realize now that taking on this project may have been a mistake :-)I taught myself how to use the design side of Dream Weaver. These five ApDivs were created in the content area of the spry tool and it worked fine. (yes a lot of work though)For the first time I looked at the code side. I wanted to try to bring a peace of code from another page for something unrelated and when it didn't work I took it out and without noticing, deleting a line from the Spry tool.Of course like a classic newbe I was working without a backup copy so here I am. Loosing hours of tedious work and on the verve of tears :-)I do have some  questions though.  My APDiv
      What does "apDiv1" stands for and what does "My APDiv" stands for?Is the only thing I have to do is changing this line for my five ApDivs and paste it in the appropriate places in the code? Thanks again,Gilaad
    Date: Sat, 16 Jun 2012 20:39:07 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I insert an existing ApDiv into a tab in the Spry Tabbed Panel? 
        Re: How can I insert an existing ApDiv into a tab in the Spry Tabbed Panel? 
        created by Altruistic Gramps in Spry Framework for Ajax - View the full discussion 
    You have really made hard work for yourself by using APDiv's. I suppose it can be done, but I would not. To answer your question, I have create an example as per#apDiv1
    My APDiv
    Content 2
    Tab 1
    Gramps 
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4498679#4498679
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4498679#4498679. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Spry Framework for Ajax by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How can I insert a completed file into another PDF file I am developing?

    How can I insert a completed file into another PDF file I am developing?

    Please refer : http://acrobatusers.com/tutorials/how-to-insert-a-pdf-into-a-pdf

  • How to set a new session variable?

    Hi all,
    Can anybody say how to set a new session variable in istore?

    Hi,
    you can use either
    pageContext.getAttribute(VAR, PageContext.REQUEST_SCOPE);
    or
    <%@page session="true" %>
    session.putValue
    session.getValue
    Hope this will help.
    Thanks
    Gurjeet

  • HT3529 How do I insert a pdf file into my message?

    How do I insert a pdf file into my message? please help!

    thank you James! I suspected that this could be the solution, but i am new to iPads and it is a pain to find a file on iPad in order to do this operation, in windows there is windows explorer and i cannot see anything like that on iPad.. any hints would be appreciated!

  • How do I insert a video clip into the timeline?

    Do you happen to know how I could insert a video clip into the middle of a movie like you do in FCP? Can you add tracks and insert the clip above the spot i need to change for each movie.
    I don't want to render the whole movie (convert it into a MPeg2) each time.

    No - DVD timelines are a little different to FCP. If you need to add a clip to the stream, you need to split the exisitng clip (you could trim it back to where you want to insert the new piece) and drag the new piece onto the same timeline. If you trimmed the existing piece then add another instance of it to the timeline and trim the new part from the left until you get to what you want as the out point.
    If you have a collection of video clips on your DVDSP timeline, simply dragging a new one on will shuffle the others along appropriately. However, the audio will not shuffle with them, and you'll end up moving it all manually.
    The very best thing is to create the timeline precisely as you want it in FCP and encode it to MPEG2 before bringing it in to DVDSP. Remember that DVDSP is not an editor, it is a place to assemble your work - it won't do anything remotely like FCP in that respect.

  • HT1518 I have a Universal Keyboard how to I insert the copywrite symbol into my photographs

    Have tried but to no avail, how can I insert the Copywrite symbol into my photographs to protect them before posting online please.

    Alberto Ravasio wrote:
    You meant option+C
    Nope. On an English keyboard you get © with option-g. Option-c gets you ç.

  • How do I insert a URL link into a text document

    How do I insert a URL link into a Word document

    Don't have Word available to test, but it seems to depend on the program.
    In Pages and TextEdit, if you drag the favicon from the addrss box in your browser into the document, it will be pasted in already formatted as a clickable link expressed in plain text. The favicon (I think that's the name for that element) is this item -
    However, in AppleWorks 6.2.9, all that did was drop the raw URL into the document; and it is non-clickable, just text. In AW 6 you need to type the plain-text name for the link (how you want the underlined bit to appear), select that, then go to the Format menu and select Create Link, from it choosing Internet. In the new screen, the linkname will already be entered in the upper box; paste the URL into the lower box, and it's done.

  • How could I insert the deleted row into another table within a trigger?

    Hi,
    How could I insert the deleted row into another table within a trigger? The destination table has the same columns as the source table. Since the statements are in the trigger, it is not allowed to query the source table named 'test'. Thanks! The trigger is as follows, uncompleted:
    CREATE TRIGGER delete_trigger
    AFTER DELETE
    ON test
    FOR EACH ROW
    BEGIN
    -- How could I insert the deleted row into another table
    END delete_trigger;
    Message was edited by:
    user569548

    Hi,
    I'm not sure what's wrong there.
    I read the oracle docs about ANALYZE and ALL_TAB_COLUMNS, and did the following:
    ANALYZE TABLE my_tab VALIDATE STRUCTURE; //went ok.
    SELECT column_name
    FROM all_tab_columns
    WHERE table_name = 'my_tab'; //but no rows selected?
    This topic might not be what this thread should be about. Here I posted a new thread:
    How to get colum names of the newly created table?
    Thanks.
    Message was edited by:
    user569548

  • How do you insert a submit button into your form?

    How do you insert a submit button into a form?

    Hi,
    The submit button is included automatically. If you are distributing your form as HTML you can use the Test tab to preview your form. If you are distributing your form as PDF, you would need to generate the PDF to see the submit button.
    Regards,
    Brian

  • How to call a session variable into sql?

    for example, I have a coldfusion session variable - session.testvar
    I am writing a Stored procedure in sql server 2000. The query within my stored procedure needs to insert a value into a table. The value needs to be my CF session variable. I have no idea how this is done, does anyone else have a hunch?
    I am using coldfusion 8 and sql server 2000.

    Pass it to the SP as a variable
    - there are examples in the cf docs

Maybe you are looking for