Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5839 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

hi there..

i've been a filemaker developer for 9 years, and can write CDML as fast as i can think it..

BUT..

i have an event registration system (custom web publishing, CDML) that's being re-written in filemaker 9. I have the database built/working fine. I'm having a hard time getting started with custom web publishing (filemaker.php).

here's a quick background:

1. my database has 2 main tables.. "Event" and "Attendees".

2. there's only one record in "Event", and several Attendee records in the other table.

3. each attendee has a random, unique, 9 digit number as their "Attendee_ID".

4. we email our event invitations with SMTPit.. each invite needs to have a URL containing the Attendee_ID.. something like:

"http://server.com/form.php?Attendee_ID=" & Attendee_ID

(* alternately, i could have everyone arrive at a simple form, where they enter their ID and are taken to their registration form.. whichever is least problematic)

5. I already have a "Web" layout containing the fields needed to display online (Event and Attendee fields)

what i want is..

1. for each attendee to arrive at "form.php", and be looking at their own record. They only need 'edit' permission. No create/delete. All of these attendee records will have been created in advance.

2. this form needs to show fields from the "Event" table.. the event name, location, dates, functions, etc.

3. of course, the other fields on the form need to come from "Attendees".. name, address, which event functions they're attending, arrival date, etc..

i could write all of this in CDML in as much time as it's taken to post.. but, not in filemaker 9 (PHP). I haven't had the proverbial light bulb go off in my head yet. If someone could aim me in the right direction, i'll buy you a six pack of your favorite brew. B)

just so you know.. i already have 'form.php' connecting to 'event.fp7', and i can view a LIST of attendees, so i have the basic DEFINE and "$fm = " stuff there.

thanks in advance!

brian

Posted

Perhaps you may be more comfortale with this then?

http://fmforums.com/forum/showtopic.php?tid/184745

Posted (edited)

thanks for the info on 'blackbelt'.. looks promising.

as far as PHP, and getting fields to appear from two tables, here's what i have (below). It's working this way, but I don't want to continue if there's a better way. Basically, i resorted to just finding the attendee record and the meeting record, separately, and calling fields where i need them in the form.

i still can't figure out how to just get related (meeting) fields to show up.. but, as i said, this much is working. Just don't want to develop any sloppy habits right out of the gate. :o

feedback?


<?php



define ('FM_HOST', '127.0.0.1');

define ('FM_FILE', 'meeting');

define ('FM_USER', 'web');

define ('FM_PASS', 'webpass');



include ('Filemaker.php');

$fm = new FileMaker (FM_FILE, FM_HOST, FM_USER, FM_PASS);



$attendee = $fm->getRecordById('Web', NULL);

$id = $attendee->getField('Attendee_ID');

$fname = $attendee->getField('First Name');

$lname = $attendee->getField('Last Name');



$meeting = $fm->getRecordById('Meeting View', NULL);

$meeting_name = $meeting->getField('meeting name');

$hotel_city = $meeting->getField('hotel city');

$meeting_manager = $meeting->getField('meeting manager name');



?>



[...]



<?php



echo 'Attendee Name: ' . $fname . ' ' . $lname . '

';

echo 'Meeting: ' . $meeting_name . '

';

echo 'Location: ' . $hotel_city . '

';

echo 'Manager: ' . $meeting_manager;



[like so..]



?>







Edited by Guest
Posted (edited)

Assuming you have a layout based on Attendee with fields (no portal) from a 1:1 relationship to Event called meeting.

<?

$attendee = $fm->getRecordById('Web', NULL);

?>

Attendee Name: <?=$attendee->getField('First Name') . " " . $attendee->getField('Last Name')?>

Meeting: <?=$attendee->getField('meeting::meeting name')?>

Location: <?=$attendee->getField('meeting::hotel city')?>

Manager: <?=$attendee->getField('meeting::meeting manager name')?>

I didn't use code tags because they strip off the closing PHP tags, which IMHO makes the code example above hard to understand.

As long as we're talking about best practices, using PHP to echo out HTML is a pet peeve of mine. It's far better to separate your code as much as possible and escape in and out of PHP when you have to mix the two.

<?= is a shortcut for echo it requires the short_open_tag = On setting in your php.ini.

Edited by Guest
original example had relationship backwards from OP

This topic is 5839 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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