This topic is locked
[SOLVED]

 Multiple Page Forms (more than 2 page)

7/17/2010 6:43:09 PM
PHPRunner General questions
J
jansgroup author

continued from: http://www.asprunner.com/forums/topic/14431-multiple-page-forms/
in the above mentioned thread, you can build a 2 page form
what code would i place on the EDIT Page >> Event Tab >> After Record Updated for Page(View) 2 to then go to Page(View) 3

then what would i place on the EDIT Page >> Event Tab >> After Record Updated for Page(View) 3 to then go to Page(View) 4
and so on.
WHAT I TRIED:
i attempted to continue using:
Page(View) 2
header("Location: ThirdTable_edit.php?editid1=".mysql_insert_id());

exit();
and then
Page(View) 3
header("Location: FourthTable_edit.php?editid1=".mysql_insert_id());

exit();
and so on, however it did not work. Instead it went to ThirdTable_list.php?a=return and stopped.
Please advise as i am working on a multiple page form with more than 2 pages, about 14 to be exact.

Sergey Kornilov admin 7/18/2010

I would suggest to save mysql_insert_id() to session variable and use this session variable to build redirect URL.
AfterRecordAdded event:

$_SESSION["myid"] = mysql_insert_id();

header("Location: SecondTable_edit.php?editid1=".$_SESSION["myid"]);

exit();


In all other events:

header("Location: SecondTable_edit.php?editid1=".$_SESSION["myid"]);

exit();
J
jansgroup author 7/26/2010



I would suggest to save mysql_insert_id() to session variable and use this session variable to build redirect URL.
AfterRecordAdded event:

$_SESSION["myid"] = mysql_insert_id();

header("Location: SecondTable_edit.php?editid1=".$_SESSION["myid"]);

exit();


In all other events:

header("Location: SecondTable_edit.php?editid1=".$_SESSION["myid"]);

exit();



This worked great.
Tested on IE, Firefox, Chrome and Safari (PC).

However there is 1 remaining curious situation.
When i check on my iphone, i am able to get from page 1 (FirstTable), to page 2 (SecondTable), then when i attempt to go to page 3 (ThirdTable) of the multiple page form - it goes to ThirdTable_list.php?a=return and dies.
The core difference between page 1 and 2 and 3 on the events are:
page 1 =
create session

and simple redirect
page 2 =
simple redirect
page 3 =
includes a custom button (works in IE only if CSS, as IE does not like the type=image)
------ custom button ------
.abc1{

border: 0;

background: url("http://XXX"'>http://XXX";);

width: 000px;

height: 00px;

}

.abc2 {

border: 0;

background: url("http://XXX"'>http://XXX";);

width: 000px;

height: 00px;

}
<INPUT id=submit1 class=abc1 value=" " type=submit name=submit1>

<INPUT id=submit2 class=abc2 value=" " type=submit name=submit2>
------
page 3 also includes a few IF statements on EDIT PAGE > EVENTS > AFTER RECORD UPDATED
those statements are something like if you click submit1 do this, if you click submit2 do this.
Note: the following code is working on IE, Firefox, Chrome and Safari (PC), just not in iphone (haven't checked other smartphones, phone browsers)
------ custom code placed in EDIT PAGE > EVENTS > AFTER RECORD UPDATED ------
if ($_REQUEST["submit1"]==" ")

{

$sql = "Update XXX set XXX='Yes' where XXX=".$_SESSION["myid"];

CustomQuery($sql);

$sql2 = "Insert Into XXX (XXX, XXX) Values ('X','".$_SESSION["myid"]."')";

CustomQuery($sql2);

header("Location: ThirdTable_edit.php?editid1=".$_SESSION["myid"]);

exit();

}
if ($_REQUEST["submit2"]==" ")

{

$sql = "Update XXX set XXX='No' where XXX=".$_SESSION["myid"];

CustomQuery($sql);

header("Location: ThirdTable_edit.php?editid1=".$_SESSION["myid"]);

exit();

}
------
So, is there a way to fix this or is there a way to automatically sense the form is being utilized on an iphone (or other incompatible mobile phone) and display a message versus going to ThirdTable_list.php?a=return ???
Thanks in advance.

Sergey Kornilov admin 7/27/2010

Hard to tell what might be wrong without seeing your code.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

J
jansgroup author 7/28/2010



Hard to tell what might be wrong without seeing your code.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


Im honestly not sure that will help, this issue seems to be related almost entirely to the iPhone.

  • tested on Blackberry as success
  • tested on Droid as success
    I was thinking i might add something like this:
    if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))

    {

    header("Location: http://www.XXX.com/iphone";);

    exit();

    }
    hmmm ... i guess i will also want to check the iPad as well.

J
jansgroup author 7/28/2010



Im honestly not sure that will help, this issue seems to be related almost entirely to the iPhone.

  • tested on Blackberry as success
  • tested on Droid as success
    I was thinking i might add something like this:
    if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))

    {

    header("Location: http://www.XXX.com/iphone";);

    exit();

    }
    hmmm ... i guess i will also want to check the iPad as well.


WOW, i tested one last time before adding the HTTP_USER_AGENT detection, and now the system works on the iPhone without an issue, that's just strange! I can essentially rule out just my iPhone being quirky as it was tested on several random iPhones over several days. This is just ODD. Hmmm... One day it doesn't work, the next day it does, just ODD.