Jump to content

PLS I NEED HELP WITH MY CODE....HELP!


stallonmabro

Recommended Posts

Pls, how can i get this php code to redirect to the first header location url whenever the user input matches anyone of the numbers in the $tracking = array, and redirects to the second header location whenever the user input doesnt match any of the numbers in the $tracking = array.

 

<?php
    $tracking = $_post['tracking']; //your form method is post

    $tracking = array('91911', '91914', '91915', '91932', '91942', '91945', '91950', '92014', '92025', '92027', '92029', '92037', '92064', '92065', '92067', '92071', '92075', '92101', '92102', '92103', '92104', '92105', '92106', '92107', '92108', '92109', '92110', '92111', '92113', '92114', '92115', '92116', '92117', '92118', '92119', '92120', '92121', '92122', '92123', '92124', '92126', '92127', '92128', '92129', '92130', '92131', '92132', '92134', '92135', '92139', '92140', '92145', '92147', '92154', '92173');

    if (in_array($tracking, $tracking)){
        header("Location: http://queensdeliverys.com/".$_post['selection']);
        exit;
    } else {
            header("Location: http://www.pureflo.com");
            exit;
   }

 

 

this is the html form action and method details.

 

<form action="/QDS-tracking/validate.php" id="search-form" method="get" name="tracking"><input class="s-f-input search" id="order_number" name="TrackingModel[order_number]" placeholder="Enter your Order Number" tabindex="1" type="text" /><input class="search-btn" name="yt0" type="submit" value="Track" /></form>

?>

 

any help will be greatly appreciated, thanks

 

 

 

this is the link you can test the code on.

 

queensdeliverys.com/QDS-tracking/tracking.html

 

and it should redirect to http://queensdeliverys.com if the code is fixed, and http://www.pureflo.com if it isnt fix yet.

 

 

thanks!!

Link to comment
Share on other sites

Where to start?

 

1 - post code in the forum properly using the tags as described in the rules.

 

2 - Learn at least a LITTLE bit about php - specifically that it is case-sensitive. That means that $_post['tracking'] is invalid.

 

3 - Turn on php error checking in all your scripts during development so that things like #2 show up as the errors that they are.

 

4 - When writing code put statements on separate lines. Makes reading them much easier as well as editing later on.

 

Yes - do as Barand suggested but also do try to do some of the things that I just posted before you post more code here. It will greatly help your cause.

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.