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 7710517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:08:44+00:00 2026-06-01T01:08:44+00:00

I am looking to setup a Server that accepts a URL with a few

  • 0

I am looking to setup a Server that accepts a URL with a few variables in it which I’ll use the $_GET statement to obtain. These variables will increment counters stored on the server. I was going to write these files to a file and then open it/write to it kind of like this http://www.developingwebs.net/phpclass/hitcounter.php however this is only showing for one variable. I changed the code to reflect multiple variables but am not entirely sure how to write the multiple variables to the file. I was using this:

$counters = ("counter.txt");
$increment = file($counters);
/* Bunch of if else ladders checking the $_GET statements and
   incrementing $increments[] accordingly */
for($i; $i < 16; $i++)          //write variables to file
    fputs($fp, $increment[$i]);

Where $fp points to the text file I was using and $increment[ ] holds the variables being incremented and such. So would this work? And would this work with multiple people accessing this URL at the same time? It needs to keep an accurate count of all the variables regardless of how many people are accessing the page.

Example: a survey submitted online with 4 questions. Each response has 4 options to it so in total 16 variables being stored. People will be submitting their responses to the server randomly and possibly at the same time. I need to parse their response and update the counter accordingly even when multiple people are submitting at the same time.

Thanks for any help, hope I supplied enough detail but if not just ask questions.

EDIT: The URL is being sent from an Android device to the Server I don’t know if that changes anything but just wanted to be clear. The Android device is submitting the survey responses.

  • 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-06-01T01:08:46+00:00Added an answer on June 1, 2026 at 1:08 am

    Building on Graham’s comment, you’d be far better off letting your database server handle responses, and building your totals as part of a reporting system rather than part of the form submission process.

    Here’s an example, in sort-of-meta code. First, your HTML form:

    <form method="GET"> <!-- though I recommend POST instead -->
     <input type="checkbox" name="ch[1]"> Checkbox 1
     <input type="checkbox" name="ch[2]"> Checkbox 2
     <input type="checkbox" name="ch[3]"> Checkbox 3
    </form>
    

    Then, the PHP that receives the form:

    <?php
    
      $qfmt = "INSERT INTO answers (question, answer) VALUES ('%s, '%s')";
    
      foreach ($ch as $key => $value) {
        if ($value == 'Yes') {
          $query = sprintf($qfmt, $key, $value);
          mysql_query($query);
        }
      }
    
      print "<p>Thanks!</p>\n";
    
    ?>
    

    Lastly, to gather your totals:

    SELECT COUNT(*) FROM answers WHERE question = '1';
    SELECT COUNT(*) FROM answers WHERE question = '2';
    SELECT COUNT(*) FROM answers WHERE question = '3';
    

    You can adapt this to handle other form input as well, and perhaps store a long-lived session cookie to let you detect whether the same browser gets used to fill out your form multiple times.

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

Sidebar

Related Questions

I'm looking for a lightweight, easy to setup CI server that I can run
I'm looking for an SMTP server that I can setup on a windows machine:
I'm looking to setup a custom route which supplies implicit parameter names to a
I'm looking to setup emacs to allow me to use perforce without having to
I'm trying to build a server that will handle many concurrent connections to iPhone
I'm looking for a PHP profiler that works with Zend Server (CE). From what
I want to prototype a server component that accepts and handles file uploads from
I'm looking into creating a user friendly setup wizard which does the following: Ask
I am looking for some guideance in terms of what database to use server(using
I need to have an android device act as a wifi server/hub that will

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.