AbhiN Posted February 12, 2008 Share Posted February 12, 2008 Hi i m using following code for displaying captcha image-- <?php session_start(); $PHP_SELF = $_SERVER['PHP_SELF']; $errore = 0; if(isset($_POST['submit']) && isset($_SESSION['captcha'])) { if(isset($_POST['code'])){ $_code = $_POST['code']; if($_SESSION['captcha'] == $_code){ header("Location: contact2.php"); exit; } else { $errore = 1; } } else { $errore = 1; } } if(!isset($_SESSION['captcha'])){session_register('captcha');} $PHP_SELF = $_SERVER['PHP_SELF']; $stringa = ''; $cifre = 5; for($i=1;$i<=$cifre;$i++){ $letteraOnumero = rand(1,2); if($letteraOnumero == 1){ // lettera $lettere = 'ABEFHKMNRVWX'; $x = rand(1,11); $lettera = substr($lettere,$x,1); $stringa .= $lettera; } else { $numero = rand(3,7); $stringa .= $numero; } } $_SESSION['captcha'] = $stringa; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Captcha entrance page</title> <style media="all" type="text/css"> #captcha{margin:0 auto;text-align:center} .errore{color:#f00} .style2 { font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; } .style3 {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000099; } </style> </head> <body> <table width="100" height="54" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="Table_01"> <tr> <td height="39" align="left" valign="top" ><h1 class="style2"><img src="3EImages/dot3E.jpg" alt="" width="29" height="29" align="left" class="imagesstyle" />Contact Us<br /> </h1></td> </tr> <tr> <td align="left" valign="top" class="tableDetail"> <br /> Kindly fill all the required fields. We will get in touch with you within 24 hours.</p> <p> </p> <p align="right"> <label> *Name: <input type="text" name="name" id="name" size="30"/> </label></p> <p align="right">*Email Address: <label> <input type="text" name="email" id="email" size="30" /> </label> </p> <p align="right">Phone No: <label> <input type="text" name="phone" id="phone" size="30" /> </label> </p> <p align="right" style="">Interseted in: <label> <textarea name="interested" cols="30" rows="6" wrap="physical" id="interested"> </textarea> </label> </p> <p align="right"> <div id="captcha"> <p><img src="captcha.php" /></p> <form id="captchaform" action="<?php echo $PHP_SELF ?>" method="post"> <p><label for="code">Code: </label><input type="text" name="code" id="code" /></p> <p><input type="submit" id="submit" name="submit" value="Enter" /></p> </form> <?php if($errore == 1){ ?> <p class="errore">The code you inserted was not correct .<br /> <a href="<?php echo $PHP_SELF ?>">Click here to generate a new Captcha code and try again</a></p> <?php } ?> </div> </p> </td> </tr> </table> </body> </html> Now here i validated the code entered by user.. But If the code is correct i want to locate to another php which sends the mail.. So on this page i want the data entered in the previous page.. then how do i get data from this php to next php.. plz reply.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.