[FX.php List] Creating header record and x sub-recordsfrom one
Submit
Steve Winter
steve at bluecrocodile.co.nz
Wed Oct 10 01:54:25 MDT 2007
Hi Tim,
I’m a bit lost here, but what if, on your submission page you loaded the
values into an array for posting back, something like;
<?php $i=0; ?>
<form action="myForm.php" method="post">
<p>Sub record 1<br />
<input type="hidden" name="pickMe[<?php echo $i; ?>]" value="notMe" />
<input type="checkbox" name="pickMe[<?php echo $i; ?>]" checked
value="R1741841">
<input type="hidden" name="Account[<?php echo $i; ?>]" value="BHP
Steel"></p>
<?php $i++; ?>
<p>SubRecord 2<br />
<input type="hidden" name="pickMe[<?php echo $i; ?>]" value="notMe" />
<input type="checkbox" name="pickMe[<?php echo $i; ?>]" checked
value="R1743443">
<input type="hidden" name="Account[<?php echo $i; ?>]" value="BHP
Steel"></p>
<p><input type="submit" name="button" id="button" value="Submit" /></p>
</form>
(Of course if the data that you’re displaying is coming from a db query this
is can be written with a foreach loop anyway)
Then when you get to your processing page, you can do the parent submit, get
your master record ID, then a loop of the kind;
For($i=0; $i<count($_POST[‘pickMe’]); $i++) {
If($_POST[‘pickMe’][$i] != ‘notMe’) {
$myQuery = new FX( etc
$myQuery -> AddDBParam(‘pickMe’, $_POST[‘pickMe’][$i]); // not sure if
this needs to go into db?
$myQuery -> AddDBParam(‘account’, $_POST[‘account’][$i]);
$myQuery -> AddDBParam(‘parentID’, [ID from creating MasterRecord]);
$myData = FMNew();
}
}
Helpful...??...
Cheers
Steve
-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Tim 'Webko' Booth
Sent: Wednesday, 10 October 2007 8:33 a.m.
To: FX.php Discussion List
Subject: Re: [FX.php List] Creating header record and x sub-recordsfrom one
Submit
At 05:04 PM 10/10/2007, you wrote:
>Stuff the ID from the current master record in a $_SESSION -variable, such
as
>$_SESSION['currentMainRecordID'];
I can do this bit.... Don't really need to do that in this case, as
$mainRecordID = [ID from creating MasterRecord] will suffice on the same
page.
>and use FMNew() for the sub records
And put the data from SubRecord 1 in the first record, SubRecord2 in
the 2nd ... SubRecord n in the nth record how? That's the bit I need
some assistance with...
> >
> > SubRecord 1
> > <input type="checkbox" name="pickMe" checked value="R1741841">
> > <input type="hidden" name="Account" value="BHP Steel">
> >
> > SubRecord 2
> > <input type="checkbox" name="pickMe" checked value="R1743443">
> > <input type="hidden" name="Account" value="BHP Steel">
> >
> > ...
> >
> > SubRecord n
> > <input type="checkbox" name="pickMe" checked value="R1743447">
> > <input type="hidden" name="Account" value="BHP Steel">
> >
> > <p align="right"><input type="submit" name="ak" value="Create
Request"></p>
> > </form>
> >
> >
> > Thoughts?
Cheers
Webko
--
NicheIT Pty Ltd
http://www.nicheit.com.au
_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.6/1060 - Release Date: 9/10/2007
4:43 p.m.
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.6/1060 - Release Date: 9/10/2007
4:43 p.m.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20071010/fb203d92/attachment-0001.html
More information about the FX.php_List
mailing list