Populate form with Job offer(s)
4 posts by 2 authors in: Forums > CMS Builder
Last Post: Friday at 11:32am (RSS)
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!
interactivetools.com
Hi Dave,
I need a littlebit more help on this please...
I have this page with Jobs listing: https://metalprojects-overpelt.be/vacatures_test.php
With this code:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
require_once "/home/metalpro/public_html/beheer/lib/viewer_functions.php";
list($vacaturesRecords, $vacaturesMetaData) = getRecords(array(
'tableName' => 'vacatures',
'where' => "hide_listing != 0",
));
$numValue = getLastNumberInUrl('1');
?>
<?php foreach ($vacaturesRecords as $record): ?>
<div class="page-inner">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="section-info">
<div class="title-hr"></div>
<div class="info-title">Vacature</div>
</div>
</div>
<div class="col-md-9">
<div class="entry-content">
<h3 class="entry-description"><?php echo $record['title'] ?></h3>
<p align="justify"><?php echo $record['content'] ?></p>
<p>» <a href="contact_vac.php?num=<?php echo urlencode($vacaturesRecord['num']) ?>">Reageren op deze vacature</a></p>
</div>
</div>
</div>
</div>
</div>
<?php endforeach ?>
I just don't know how to get the 'num' variable for each Job...
And the Job contact page: https://metalprojects-overpelt.be/contact_vac.php
With this code:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
require_once "/home/metalpro/public_html/beheer/lib/viewer_functions.php";
// load record from 'panden'
list($vacaturesRecords, $vacaturesMetaData) = getRecords(array(
'tableName' => 'vacatures',
'where' => whereRecordNumberInUrl(1),
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$vacaturesRecord = @$vacaturesRecords[0]; // get first record
if (!$vacaturesRecord) { dieWith404("Record not found!"); } // show error message if no record found
?>
<div class="cfg-element-set" id="cfg-element-23-9-set" >
<div class="cfg-element-content">
<input name="cfg-element-23-9" type="text" class="cfg-type-text cfg-form-value " id="cfg-element-23-9" value="<?php echo $vacaturesRecord['title'] ?>" />
</div>
</div>
As you can see my knowledge of PHP is weak, but I think this is just a matter of the correct code in these 2 pages...?
Please if you could help me out with this... much obliged!
Thanks!
By Dave - Friday at 11:32am
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!
interactivetools.com