Populate form with Job offer(s)

7 posts by 2 authors in: Forums > CMS Builder
Last Post: Thursday at 1:07pm   (RSS)

By kovali - April 9

Hi,

On a page with job offers I want to create a link (for each job offer) to a new page with only a contactform where the first field should be automatically filled in with that corresponding job offer. How can I achieve this please?

Thx !!

By Dave - April 10

Hi kovali, 

The first step is to determine if your contact form accepts input from the URL.  Have a look at the code and see if you can pass in values like this:

myContactForm.php?name=Dave&email=user@example.com

If your contact form does that then you can create a link from your CMSB viewer files something like this:

<a href="myContactForm.php?name=<?php echo urlencode($record['name']) ?>&email=<?php echo urlencode($record['email']) ?>">

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By Dave - April 26

Hi Kovali, 

We have a utility function that shows you all the available values.  Try this: 

<?php showme($record); ?>

See if the value you want is in that list and then you can output it with: <?php echo $record['fieldname']; ?>

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By kovali - Thursday at 8:04am

Hi Dave, thanks already.

I managed to do this before but from a Detailpage.php > contactform.php

Now that I'm working from a Listpage.php I'm stuck... 

Could you please help me out with an example code for this so I can understand and finalize this requirement for my client ? 

Thank you a thousand times!

Koen

By Dave - Thursday at 10:49am

Hi Koen, 

So you're trying to create a link from the list page to the details page? 

Try adding the showme inside the foreach like this: 

<?php foreach ($vacaturesRecords as $record): ?>
    <?php showme($record); ?>

That will show you all the available fields, then typically you'd create a link with: 

<?php echo $record['_link']; ?> or <?php echo $record['num']; ?>

Give it a try and let me know how far you get.

Dave Edis - Senior Developer
interactivetools.com

By kovali - Thursday at 1:07pm

Sorry Dave, but no, I want to create a link from the List page (with many job offers) to a contact form where people can apply for the job... Not to a detail page (there is no detail page at all). So that the title of the job offer will automaticaly be filled in in the first field of the form when clicked on the link "apply for this job" on the List page. 

I'm sorry for not being clear enough. The code should be: List page > contact form

Thx!