Redirect based on customer input
Results 1 to 11 of 11

Thread: Redirect based on customer input

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    7

    Redirect based on customer input

    Really need some help
    im a newbie to PHP
    and im trying to setup this site for my company
    i got the code working on a test.php with no css what so ever

    but once the code is inserted into index.php
    it breaks and doesnt work
    sometimes it doesnt even work and sometimes i get headers already sent

    Code:
    http://printingmob.com/index.php
    http://printingmob.com/test.php

    Someone please help me

  2. #2
    Senior Member
    Join Date
    Mar 2009
    Posts
    802
    We have almost no information to go on, and no code to look at, how do you expect us to help you?

    In any case, headers already sent indicates there's some kind of output before you're doing the redirect. I would check that.
    Declare variables, not war.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Quote Originally Posted by Bonesnap View Post
    We have almost no information to go on, and no code to look at, how do you expect us to help you?

    In any case, headers already sent indicates there's some kind of output before you're doing the redirect. I would check that.
    sorry about that

    index.php
    PHP Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Printing Mob | High quality print at low cost</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="keywords" content="some keywords that best describe your business">
        <meta name="description" content="a short description of your company">
        <meta name="author" content="Wizm">

        <!-- Mobile Specific Metas
        ================================================== -->
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

        <!-- CSS
        ================================================== -->
        <link rel="stylesheet" href="css/bootstrap.css" type="text/css" media="screen">
        <link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css" media="screen">
        <link rel="stylesheet" href="css/layout.css" type="text/css" media="screen">
        <link rel="stylesheet" href="css/background.css" type="text/css" media="screen">
        <link rel="stylesheet" href="colorbox/colorbox.css" type="text/css" media="screen">

        <!-- Favicons
        ================================================== -->
        <link rel="shortcut icon" href="#">

    </head>
    <body>

        <!-- Primary Page Layout
        ================================================== -->
    <div class="container">
        <div class="row">
            <header class="span12">
                <div class="logo dark">
                    <img src="http://printingmob.com/images/logo_red.png" draggable="false"/>
                    <h1>We are currently working on a awesome new site.</h1>
                </div>
            </header>
        </div>
        <div class="row">
            <header class="span6">
                <div class="description dark">
                    <p>We have been spending long hours in order to launch our new website. But for now enter the Referral Code we gave you!</p> 
                    <?php
    if (isset($_POST['submit']))
    {
        
    header("Location: http://easyonlineprint.com/?tracking=" $_POST['code']);
    }
    ?>
    <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                                
                                <input class="emailsubscribe input-large email span4" type="text" name="code" placeholder="Enter Referral Code Here" onFocus="if(!this._haschanged){this.value=''};this._haschanged=true;" />
                                <input class="btn btn-info btn-medium" type="submit" name="submit" value="Go!" id="submit"/>
                            </form>        
                </div>
            </header>
        </div>
            <div class="row">
                <div class="span4">
                    <div class="header-widget">
                    
                    </div>
                </div>
                <div class="span4">
                    <div class="header-widget">
                        
                    </div>
                </div>
            </div>
        <div class="row">
            <div class="span6">
                <div class="socmed">
                    <div class="twitter"><a href="http://twitter.com/ezonprint">Twitter</a></div>
                    <div class="facebook"><a href="http://on.fb.me/easyonlineprint">Facebook</a></div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="span3">
                <div class="copy dark">Copyright &copy; 2012 Member of EasyOnlinePrint.com</div>
            </div>
        </div>
    </div>


        <!-- JS
        ================================================== -->
        
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
        <script type="text/javascript" src="js/jquery.countdown.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/countdown.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/flickr.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/jflickrfeed.min.js" charset="utf-8"></script>
        <script type="text/javascript" src="colorbox/jquery.colorbox.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/supersized.3.2.7.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/images.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/form.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/cssLoader.js" charset="utf-8"></script>
        <script type="text/javascript" src="js/jquery.tweet.js" charset="utf-8"></script>

        <!-- End Document
        ================================================== -->
    </body>
    </html>
    test.php
    PHP Code:
    <?php
    if (isset($_POST['bt']))
    {
        
    header("Location: http://easyonlineprint.com/?tracking=" $_POST['code']);
    }
    ?>
    <html>
    <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <input type="text" name="code" id="code" />
        <input type="submit" name="bt" id="bt" value="Go To" />
    </form>
    </html>

  4. #4
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Quote Originally Posted by Bonesnap View Post
    We have almost no information to go on, and no code to look at, how do you expect us to help you?

    In any case, headers already sent indicates there's some kind of output before you're doing the redirect. I would check that.
    Sorry about that waiting on mod to approve PHP code post

  5. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Quote Originally Posted by bsoto View Post
    Sorry about that waiting on mod to approve PHP code post

    better yet heres the code

    Code:
    http://printingmob.com/test.txt
    Code:
    http://printingmob.com/index.txt

  6. #6
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,697
    Quote Originally Posted by bsoto
    PHP Code:
    <div class="row"> 
            <header class="span6"> 
                <div class="description dark"> 
                    <p>We have been spending long hours in order to launch our new website. But for now enter the Referral Code we gave you!</p>  
                    <?php 
    if (isset($_POST['submit'])) 

        
    header("Location: http://easyonlineprint.com/?tracking=" $_POST['code']); 

    ?>
    Quote Originally Posted by php.net/manual/en/function.header.php
    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  7. #7
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Can you help me fix it please! Ive been working on it all week and cant get it ived tried so many ways

  8. #8
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    figured it out

  9. #9
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,697
    Glad to hear it ... I hoped I'd given you enough direction.

    Please go to the top of the page and use the "Mark Thread RESOLVED" link under the "Thread Tools" drop-down. Thanks, and welcome to PHPBuilder!
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  10. #10
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Quote Originally Posted by dalecosp View Post
    Glad to hear it ... I hoped I'd given you enough direction.

    Please go to the top of the page and use the "Mark Thread RESOLVED" link under the "Thread Tools" drop-down. Thanks, and welcome to PHPBuilder!
    yeah i changed the whole way the header loads

    and also ended up being a java script issue


    can you possibly help make it when people dont enter anything it tells them to enter something?

  11. #11
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,697
    I'd think it'd be best to learn Javascript in order to do that. Google for things like "check required fields" and you get stuff like this. I can tell you that the link is giving guidance in the direction you want to go; however, I note that it was written for ancient browsers, and it's likely that the JS there would need to be revised and brought "up to snuff" for modern browsers. Good luck!
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •