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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:37:21+00:00 2026-05-18T06:37:21+00:00

SOLVED: added some java to the Page 1 code to read the URL parameters

  • 0

SOLVED: added some java to the Page 1 code to read the URL parameters and then modified the Ajax code as follows:

var d = gup( 'd' );

    new Ajax.Request('new_respondent_role_video.php?d=' + d,

Thanks to you all for your help.

EDIT:

The new url that a user will click to access the site is as follows:

http://www.xyv.com/ttt/index.php?r=1&d=2010-11-24

This URL contains the d date variable – I need to pass that through the Function so it gets added to the database.

Hope that makes a little more sense?

H.

Hi,

I hope some can help. I have inherited the following code across multiple pages and I have been asked to make some modifications to the code, detailed below but am really struggling.

URL for Page 1

http://www.xyv.com/ttt/index.php?r=1

Page 1

<?php include_once("db.inc.php");
//$i = 2;
$i = $_GET['r'];
if ($i == 1) {
  include("_inc/login_script_role_video.php");
  echo "<h1>Loading questionnaire please wait.</h1>";
}else if($i == 2){
  include("_inc/login_scriptm_role_video.php");
  echo "<h1>Loading questionnaire please wait.</h1>";
}else if($i == 3){
  include("_inc/login_scriptd_role_video.php");
  echo "<h1>Loading questionnaire please wait.</h1>";
}else{
  echo "<h1>You have tried to access the survey without a correct id, ",
       "please refer to your invitation email.</h1>";
}

//echo $i;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title><?php include("_inc/title.php"); ?></title>
  <link rel="stylesheet" type="text/css" href="main.css" />
  <script src="main.js" type="text/javascript"></script>
  <script src="javascripts/scriptaculous.shrunk.js" 
  type="text/javascript" charset="ISO-8859-1"></script>
</head>
<body onload="startSurvey();">

</body>
</html>

This page directs to a login script depending on the r in the URL.

startSurvey code

function startSurvey(){
/* var respondent_id = document.getElementById('respondent_id').value;
if(1==0) { if open survey, use respondent_id.length==0*/
    new Ajax.Request('new_respondent_role_video.php',
      {
        method:'get',
        onSuccess: function(transport){
          var respondent_id = transport.responseText;
          window.location='prog-role-video.php?r=' + respondent_id;
        },
        onFailure: function(){
              Effect.Appear('problem');
            }
      });
}

Opens another file to add a respondent to the database and then re-direct the user.

New respondent file

<?php
include_once("db.inc.php");

$respondent_id = new_respondent_role_video();

header("Content-type: text/plain");

echo $respondent_id;
?>

Returns the respondent_id to secure access to the site can continue

SQL code

function new_respondent_role_video() {
$d = $_GET['d'];

global $link;
$proc = mysqli_prepare($link, "INSERT INTO trespondent ".
      "(code, link, role, course, page, dates) ".
      "VALUES (uuid(), 'http://www.1.xyc.co.uk/tmg/prog-role-video.php?r=', ".
      "'STAFF', 'story telling', '8', '2010-10-10');");
mysqli_stmt_execute($proc);
$id = mysqli_insert_id($link);
mysqli_stmt_fetch($proc);
mysqli_stmt_close($proc);
mysqli_clean_connection($link);

global $link;
$proc = mysqli_prepare($link, "SELECT code FROM trespondent ".
    "WHERE respondent_id = ?");
mysqli_stmt_bind_param($proc, "i", $id);    
mysqli_stmt_execute($proc);
mysqli_stmt_bind_result($proc, $code);
mysqli_stmt_fetch($proc);
mysqli_stmt_close($proc);
mysqli_clean_connection($link);
return($code);

}

Adds new user and then returns the ID for that user.

What is needed

I need to add another variable to the url, like so

http://www.xyv.com/ttt/index.php?r=1&d=2010-11-24

I then need to pass that variable d through to the add new user code, so it adds the dates into the dates field of the database, something like this:

$d = $_GET['d'];

$proc = mysqli_prepare($link, "INSERT INTO trespondent_tmg ".
  "(code, link, role, course, page, dates) VALUES (uuid(), ".
  "'http://www.1.xyz.co.uk/xyz/prog-role-video.php?r=', ".
  "'STAFF', 'The role of video in multi-media story telling', '8', '$d');");

No matter where I place the $GET code I cannot get the pages to pass this variable to Function and thus add the d date variable to the database.

Any help, ideas, suggestions welcomed.

Fully appreciate this is not the best/easiest but if someone can help….very much appreciated.

Homer.

  • 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-18T06:37:21+00:00Added an answer on May 18, 2026 at 6:37 am

    You probably just have to alter the following line to include your d variable (unless there are some other things you didn’t mention) :

    new Ajax.Request('new_respondent_role_video.php'
    

    ie.

    new Ajax.Request('new_respondent_role_video.php?d=2010-11-25'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: Solved, with code I got it working, see my answer below for the
Edit : Solved, there was a trigger with a loop on the table (read
I have a java.util.Timer running at a fixed interval. I have added a Runtime#addShutdownHook
SOLVED: Nevermind, the links were visited, and the border definition was missing for visited
Problem solved: Thanks guys, see my answer below. I have a website running in
I've actually solved this, but I'm posting it for posterity. I ran into a
I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
Edit: I have solved this by myself. See my answer below I have set
This problem has been solved thanks to your suggestions. See the bottom for details.

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.