• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

php sessions

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

    php sessions

    Cobble together a little bit of php occasionally but don't really understand the basics, like sessions.

    There's a freeware captha script that you can add to an HTML form:

    <img src="CaptchaSecurityImages.php?width=100&height=40 &characters=5" /><br />
    <input id="security_code" name="security_code" type="text" /><br />
    <input type="submit" name="submit" value="Submit" />

    The CaptchaSecurityImages.php PHP is:

    <?php
    session_start();
    blah blah
    $_SESSION['security_code'] = $code;
    blah blah
    session_write_close();
    ?>

    That works fine from a normal HTML form, but I want to use it in a form that is itself generated by php:
    <?php include 'header.php'; ?>
    <?php
    etc

    Removed the session start and close above and put session_start at beginning of php but can't access $_SESSION['security_code'] in the rest of the code.

    Any ideas, cheers.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    #2
    Stick it in a function so that you get a result back?
    Behold the warranty -- the bold print giveth and the fine print taketh away.

    Comment

    Working...
    X