chaddesign Posted July 6, 2012 Share Posted July 6, 2012 What needs to happen is when a link is clicked, the lytebox opens and has a single text field. Depending on what is entered in that field , is what determines where you go. So i need to know how to code that. For example, when someone clicks a button "Enter Code" .... a lytebox pops up with an entry field for the user to enter the code, lets say we have 2 codes, 1) 000000 2) QYWN39 If the user enters code "000000" ...the lytebox closes and "Code1.php" is loaded if the user enters code "QYWN39" ...the lytebox closes and "Code2.php" is loaded make sense? I'm thinking of a single file, simple code... not database driven, I don't need an admin panel. Any help is appreciated! Thanx Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 6, 2012 Share Posted July 6, 2012 this is a example only you want more advanced then ask... <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array("123","456","789"); if(in_array($_POST['num'],$number_array)){ echo "It in there"; }else{ echo" It not there"; } } ?> <br /> <br /> <form method="POST" action=""> <b>Please enter you secuity number.</b> <br /> <br /> <input type="password" name="num"> <input type="submit" name="submit" value="submit"> </form> Quote Link to comment Share on other sites More sharing options...
chaddesign Posted July 6, 2012 Author Share Posted July 6, 2012 Thats kinda what I'm looking for, but not exactly. Here is my goal, I have a product I'm selling, I have a spash page to funnel the users, each advertising avenue has it's own discount code. I want the discount code to take the user to it's own ordering page, so I can know which form of advertising is working best, based on which page gets the most orders Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted July 6, 2012 Share Posted July 6, 2012 if you want somebody to do this for you, you should open a listen in the freelancer section Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 6, 2012 Share Posted July 6, 2012 expanded a little more <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array("123"=>"www.gogle.com","456"=>"www.yahoo.com","789"=>"www.msn.com"); if(preg_match("/([A-Za-z])/",$_POST['num'])){ echo "<b>Sorry stop trying to use stupid letters, you no the rules dude! </b><br />"; } foreach($number_array as $val=>$number_wanted){ if($_POST['num']=="$val"){ header("location: http://$number_wanted"); break; }else{ echo" It not there"; break; } } } ?> <br /> <br /> <form method="POST" action=""> <b>Please enter you secuity number.</b> <br /> <br /> <input type="password" name="num"> <input type="submit" name="submit" value="submit"> </form> Quote Link to comment Share on other sites More sharing options...
chaddesign Posted July 6, 2012 Author Share Posted July 6, 2012 Awesome, that's so close to exact! But the other values (456, 789) don't work, just the primary code does. Shoot me a paypal invoice and I'll toss you some bones for the trouble. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 6, 2012 Share Posted July 6, 2012 NO MONEY JUST FRIENDS, IF U WANT TO DONATE MENTION ME OK LOL expanded a little more <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array("123"=>"www.gogle.com","456"=>"www.yahoo.com","789"=>"www.msn.com"); if(preg_match("/([A-Za-z])/",$_POST['num'])){ echo "<b>Sorry stop trying to use stupid letters, you no the rules dude! </b><br />"; } foreach($number_array as $val=>$number_wanted){ if($_POST['num']=="$val"){ header("location: http://$number_wanted?add=1"); break; }else{ echo" It not there"; break; } } } ?> <br /> <br /> <form method="POST" action=""> <b>Please enter you secuity number.</b> <br /> <br /> <input type="password" name="num"> <input type="submit" name="submit" value="submit"> </form> all you need to do is adjust the urls in the array to your pages.php and change the correct numbers.(the url should be named as the advert campain) when the number is entered in the form ,your go to your new page. all you need to do is say this to update the database. <?php if($_GET['add']=="1"){ //update the database ,where the name of the database column is the same as the page we are on, and add 1 to the adding row of the database. } ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 6, 2012 Share Posted July 6, 2012 YOU HAVE A LITTLE THINK AND ILL REST LOL, WHEN YOU NEED MORE HELP COME BACK OK. Quote Link to comment Share on other sites More sharing options...
chaddesign Posted July 6, 2012 Author Share Posted July 6, 2012 GOT IT! It's workin great! Is there a way to allow letters as well? Sorry to sound like a novice, but when it comes to development, I am. Design is my strength, lemme know you're ever in the need! Quote Link to comment Share on other sites More sharing options...
chaddesign Posted July 6, 2012 Author Share Posted July 6, 2012 Nevermind I figured it out! Thanx again man! Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 6, 2012 Share Posted July 6, 2012 this is a example how to add a number to the database when you go to the new page. UPDATE Adding_Table SET Adding_column=Adding_column+1 WHERE SPECIAL_NUMBER="WHAT_EVER";, Quote Link to comment Share on other sites More sharing options...
chaddesign Posted July 6, 2012 Author Share Posted July 6, 2012 This worked too, without the need of a database, it's purpose is just a hub. Thanks a bunch man! <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array('AbCd1zyZ9', 'foo!#$bar'); if(preg_match("/^[a-zA-Z0-9]+$/", $value)){ echo "<b>Sorry stop trying to use stupid letters, you no the rules dude! </b><br />"; } foreach($number_array as $val=>$number_wanted){ if($_POST['num']=="1g2h3j"){ header("location: /1g2h3j.php"); } if($_POST['num']=="2v3b4n"){ header("location: /2v3b4n.php"); } if($_POST['num']=="4n5j6i"){ header("location: /4n5j6i.php"); break; }else{ echo" It not there"; break; } 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.