Jump to content

Need a simple PHP Code Solution, any ideas?


chaddesign

Recommended Posts

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

Link to comment
Share on other sites

 

 

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

 

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.
}
?>

Link to comment
Share on other sites

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;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.