Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I keep adding information into same record?

Featured Replies

Hi,

I am new at php. I am creating a survey with 150 question, but using several php pages instead 1.

My problem is to make the information of each page go to the same record instead create a new record.

How do I keep adding information to the same record if I have several php pages.

The code that I have unitil now are:

=======index.php======

 

<form action="evaluation.php">

<table width="150" border="0" align="center">

  <tr>

    <td width="22"><input name="have_program" type="radio" value="Don't know"></td>

    <td width="118">Don't know </td>

  </tr>

  <tr>

    <td><input name="have_program" type="radio" value="Yes"></td>

    <td>Yes</td>

  </tr>

  <tr>

    <td><input name="have_program" type="radio" value="No"></td>

    <td>No</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

    <td height="25"><input name="name_last" type="text" id="name_last"></td>

  </tr>

  <tr>

    <td>&nbsp;</td>

    <td><input type="submit" name="Submit" value="Continue --&gt;&gt;"></td>

  </tr>

</table>

<div align="center"></div>

<p>&nbsp;</p>

</form>

 
 



======evaluation.php======

 
 

<?PHP

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FX.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/server_data.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FMErrors.php");



$new_member =  new FX($serverIP,$webCompanionPort);

$have_program = $_GET[have_program];

$new_member->SetDBData('survey.fp7','cgi');

$new_member->SetDBPassword('password','admin');

$new_member->AddDBParam('have_program',implode("n", $_GET[have_program]));

?>

<?php

switch ($have_program)

{

case "Don't know";

include ('do_not_know/new_survey_info.php');

break;



case 'Yes';

include ('thankyou.php');

break;



case 'No';

include ('no/no_continue.php');

break;



default;

echo("only 'yes', 'no', or 'other can be selected.n");

include ('index.php');

}

?>

 
 



=======If I click "No" it will take me to "no_continue.php"============

 
 

<?PHP

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FX.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/server_data.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FMErrors.php");



$new_member =  new FX($serverIP,$webCompanionPort);

$have_program = $_GET[have_program];

$new_member->SetDBData('survey.fp7','cgi');

$new_member->SetDBPassword('password','admin');

$have_program = $_GET[have_program];

$new_member->AddDBParam('have_program',$have_program);

$added = $new_member->FMNew(); 

?>

<body>

<?php 

foreach ($added['data'] as $recordKey =>$recordData) {

 ?>

<?php echo $recordData['survey_id'][0]; ?>

The survey should take no more than 15 minutes to complete. Thank you for your participation

Please <a href="no/research_page.php?area=research_page&survey_id=<?php echo $recordData['survey_id'][0]; ?>">CLICK HERE</a> to continue </p>

<?php } ?>

 
 



====research_page.php====

<?PHP

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FX.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/server_data.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FMErrors.php");

$search_result = new FX($serverIP,$webCompanionPort);

$survey_id = $_GET[survey_id];

$search_result->SetDBData('survey.fp7','cgi');

$search_result->SetDBPassword('password','admin');

$search_result->AddDBParam("survey_id","$survey_id");

$member_list = $search_result-> FMFind();   

 ?>



<body>

 <?php

foreach ($member_list['data'] as $recordKey =>$recordData) {

?>



<form action="no/background_page.php?area=background_page&survey_id=<?php echo $recordData['survey_id'][0]; ?>">

<?php echo $recordData['company_id'][0]; ?>

 <textarea name="research_type" cols="50" value="<?php echo $recordData['research_type'][0]; ?>"></textarea>

<textarea name="research_findings" cols="50" value="<?php echo $recordData['research_findings'][0]; ?>"></textarea>

<input type="hidden" name="recid" value="<?php echo $recordData['recid'][0]; ?>">

<input type="submit" name="Submit" value="Submit">

</form>

<?php } ?>



======background_page.php =====

My problem is here if in case I want to keep entering more information to the same record 

how should I do that? Does anyone have any idea?



 
 

<?PHP

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FX.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/server_data.php");

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FMErrors.php");



$search_result = new FX($serverIP,$webCompanionPort);

$survey_id = $_GET[survey_id];

$research_done = $_GET[research_done];

$research_type = $_GET[research_type];

$research_findings  = $_GET[research_findings];

$additional_info  = $_GET[additional_info];

$future_description_if_yes  = $_GET[future_description_if_yes];

$additional_info2 = $_GET[additional_info2];

$recid = $_GET[recid]; 

 

$search_result->SetDBData('survey.fp7','cgi');

$search_result->SetDBPassword('password','admin');

$search_result->AddDBParam("survey_id",$survey_id);

$search_result->AddDBParam("-recid",$recid);

$search_result->AddDBParam("research_type",$research_type);

$search_result->AddDBParam("research_findings",$research_findings);

$member_list = $search_result->FMEdit();  

?>

My problem is here if in case I want to keep entering more information to the same record 

how should I do that? Does anyone have any idea? I tried to have FMfind() but didn't work.



 

php2005 :confused:

In the "research_page.php" page, can you see the "recid" when you view the page source in the browser?

I notice that you are using a GET in the "background_page.php". Try setting the Form in the "research_page.php" page to "method='POST'". Then change the $_GETs to $_POSTs in the "background_page.php".

Good Luck.

Garry

I agree, use POST to pass values through each page.

<form name="formname" method="post" action="nextpage.php">

If you need to track data across multiple pages for a single record, simply grab the recid early, you can then pass it through each page in a hidden field:

<input type="hidden" name="recid" value="<?=$recid?>" />.

Another track: create a PHP session variable to store the recid on the server. Then grab it as needed. A client-side cookie may work too (probably not here though). Learn more about PHP sessions, security concerns, etc. at http://www.php.net

Hope this helps.

Shannon

-=-=-

  • Author

Hi Gary and Shannon,

Thank you so much for the help. It is working now.

PHP2005

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.