• 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

5.00 star(s)

xoggoth

More fingers than teeth
Thanks received
1,183
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.
 

Advertisers

Back
Top