Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:42:45+00:00 2026-05-26T22:42:45+00:00

I’m working on a little project, basically I have some text on my PHP/HTML

  • 0

I’m working on a little project, basically I have some text on my PHP/HTML page that is being echo’ed from a variable ($brief_string).

There is also a back, and continue button which basically subtracts or adds to another variable ($brief_page – which is pulled from my DB). The brief_string changes depending on the brief_page by using if statements. First problem I encounter is that when I hit continue (submit button) it resubmits/refreshes the page, causing my brief_page to reset back to 0.

So I’m thinking maybe I could use JS to hold the info and page variables and control the dynamic text, but then, how would I update my DB with the current page value via JS? Isn’t it really easy to manually change/hack these values? I would preferably like my DB to be updated with the page number each time the use presses the back/continue button.

I would just like some advice really as I am a student trying to develop an interactive book like site (that uses a DB to save your current page).

Code:

<?
$brief_info = "brief info goes here";
$brief_page = 0; //< will soon be pulled off DB

if (isset($_GET['brief1Go'])) {
    $brief_page = $brief_page + 1;
}
else if (isset($_GET['brief1Back'])) {
    $brief_page = $brief_page - 1;
}


$breifController = "
    <form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">
        <input type=\"submit\" name=\"brief1Back\" id=\"brief1Back\" value=\"BACK\" />
    </form>

    <form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">
        <input type=\"submit\" name=\"brief1Go\" id=\"brief1Go\" value=\"CONTINUE\" />
    </form>";



if($brief_page == 0){
    $brief1_info = "<b>Welcome Commander,</b> you are currently viewing the Mission Control Brief page, here you can view all your missions that you need to complete in order to advance through your prestiges. You will need to follow your briefs carefully in order to succeed. <br /><br />

    ";
}
else if($brief_page == 1){
    $brief_info = "Okay, let me show you around the place ...";
}
else if($brief_page == 2){
    $brief_info = "brief is on 2";
}

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:42:46+00:00Added an answer on May 26, 2026 at 10:42 pm

    Why not just use get vars entirely?

    yes, start at 0 unless $_GET[‘page’] is set…

    $brief_page = 0;
    if(isset($_GET['page']))
        $brief_page = $_GET['page'];
    

    then only use links to your next and previous pages instead of some weird post thing.

    <a href="/somefile.php?page=<?php echo $prev; ?>">Previous</a> <a href="/somefile.php?page=<?php echo $next; ?>">Next</a>
    

    where obviously the page numbers in the previous and next are just echoed from php

    $prev = $brief_page - 1;
    $next = $brief_page + 1;
    

    The user specific things to store can easily be handled with sesisons, cookies or even other get vars if you want to introduce a horrible security hole. Your choice really.
    I would definitely not do this via $_POST though. totally annoying. Go with all full on ajax if you want to do that. At least you won’t pester the user with “are you sure you want to resubmit the form data” messages if they choose to refresh the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.