" Yes" and " No" button cannot go to the next question

Discussion in 'PHP' started by wilsonljx, Mar 4, 2013.

  1. #1
    Hi People, I have some problems regarding php if I am not wrong. Inside my landing page, I have created a "yes" and "no" button and I have several questions for visitors to click but it just doesn't seem to skip to the next question.Instead, It just stuck at the first question like a loop. what php command must I use to enable my landing page to skip to the next question. Is it redirect script or something like that? I tried to add in several scripts but it still stuck at the first question without moving on to the next question whenever I press either yes or no:)
     
    wilsonljx, Mar 4, 2013 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    Show us your code... or we can't help
     
    MyVodaFone, Mar 4, 2013 IP
  3. wilsonljx

    wilsonljx Banned

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    I have attached the source code if you guys need. Here is my javascript:)



    var queryEngSec = getQueryUrl("engsec");
    var hidLocation = document.getElementById("hidLocation");
    if (queryEngSec!=null && queryEngSec!="0" && !isNaN(queryEngSec) && hidLocation!=null && hidLocation.value!='')
    {
    setTimeout( "trackEngage()", queryEngSec*1000);
    }

    function getQueryUrl(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
    ft = gy.split("=");
    if (ft[0] == ji)
    return unescape(ft[1]);
    }
    return null;
    }

    function trackEngage()
    {
    var pic=document.createElement('img');
    pic.setAttribute("src", hidLocation.value + '/adeng.php');
    pic.setAttribute("style", "display:none");
    hidLocation.parentNode.appendChild(pic);
    }

    var keyStr = "ABCDEFGHIJKLMNOP" +
    "QRSTUVWXYZabcdef" +
    "ghijklmnopqrstuv" +
    "wxyz0123456789+/" +
    "=";

    function encode64(input) {
    var output = "";
    var chr1, chr2, chr3 = "";
    var enc1, enc2, enc3, enc4 = "";
    var i = 0;

    do {
    chr1 = input.charCodeAt(i++);
    chr2 = input.charCodeAt(i++);
    chr3 = input.charCodeAt(i++);

    enc1 = chr1 >> 2;
    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    enc4 = chr3 & 63;

    if (isNaN(chr2)) {
    enc3 = enc4 = 64;
    } else if (isNaN(chr3)) {
    enc4 = 64;
    }

    output = output +
    keyStr.charAt(enc1) +
    keyStr.charAt(enc2) +
    keyStr.charAt(enc3) +
    keyStr.charAt(enc4);
    chr1 = chr2 = chr3 = "";
    enc1 = enc2 = enc3 = enc4 = "";
    } while (i < input.length);

    return output;
    }

    function checkdirect(c,l,i)
    {
    if (i===undefined)
    i='';
    document.write('<img src="' + hidLocation.value + 'adck.php?c=' + c + '&l=' + l + '&id=' + i + '&r=' + encode64(document.referrer) + "&rnd=" + Math.random() + '" />');
    }
     

    Attached Files:

    wilsonljx, Mar 4, 2013 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    This is a sterling example of what I mean when I talk about "Javascript for NOTHING", or at least, nothing besides pissing all over the page's speed, accessibility and usability. Display your four questions, put two input[radio] under each, add a input[submit], DONE! If you really want ENHANCE it with javascript from there, but this train wreck of supplanting HTML's functionality is a laundry list of how not to build a website.

    Though it does go hand in hand with the page being in "transition" from 1997 to 1998 coding practices, destroying accessibility by declaring everything in px, elements like CENTER that have NO BUSINESS in any HTML written less than a decade and a half ago, inlined presentation, inaccessible fixed widths, nothing remotely resembling semantic markup, clearing DIV like it's 2001, empty DIV doing margin or padding's job, STRONG doing numbered heading's job, SPAN for nothing, incomplete font-family, presentational images in the markup, and host of other bad, broken or just plain outdated practices that make me say -- as I often do -- throw it out and start over with semantic markup, separation of presentation from content, and STOP trying to use JavaScript to do HTML's job!

    ... and The Builder said, "If the foundation is weak, do you wail and gnash your teeth? Do you ask it to re-pour itself? Nay, you tear it down and begin anew. So shall it be with with all My Children, whether they be Stone or Flesh."

    I can't even figure out what that scripting even has to do with the markup... of course that there are no questions, no form elements, no... anything to make those even function AS questions... js for nothing and your scripts for free, that ain't working, that's NOT how you do it. -- I'm getting the general impression you are trying to do SOMETHING (not entirely clear what) client side that to be frank, has no business client-side. It's even more flawed with things like NAME on DIV -- little tip, DIV don't even HAVE a name attribute.

    I also hope that's just placeholder content -- the engrish moist goodry seems carefully crafted to make anyone smart run away thinking it's a scam. "It is the only social networking way to see in 2013 that offers simple and discreet sex partner" -- Wow... just wow. Who's the target audience, Yoda and Zathras? Gelflings?
     
    Last edited: Mar 5, 2013
    deathshadow, Mar 5, 2013 IP
    GMF likes this.
  5. wilsonljx

    wilsonljx Banned

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #5
    Hi, I agree that the page is very messy and I downloaded it online and want to edit some of the codes which is why I don't even understand how the code works. I am here because I believe there are alot of experts out there who are very knowledgeable about this which is why I am here to seek some guidance:) I do not have any technical knowledge but I am willing to learn the basics.
     
    wilsonljx, Mar 5, 2013 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    And that's what Deathshadow gave you - the basics. Delete your page, start with a modern non-transitional declaration, and build an HTML-only page that asks the questions, accepts the answers and submits to a PHP page.

    When that works, you can add Javascript checking (did they give you a numeric name or an alpha zipcode?) and use CSS to pretty it up.
     
    Rukbat, Mar 5, 2013 IP