Problem retreiving data for PDF export.

Hello everyone, I am currently building a free website for a junior sports club. The main feature of this is the online registration which I’ve decided to use Breezing Forms. When customizing the export_pdf.php file which fetches the fields from the database and arranges it in a table I noticed a problem with my code, when I attempt to separate the rows individually no data is fetched.

The original code (that works but the data cannot be styled individually):

[php]<?php
$subs = $this->getSubrecords($rec->id);
$subsSize = count($subs);
for($s = 0; $s < $subsSize; $s++) {
$sub = $subs[$s];
?>

<?php echo htmlentities($sub->title, ENT_QUOTES, 'UTF-8'); ?>: <?php echo nl2br(htmlentities(substr($sub->value,0,10000), ENT_QUOTES, 'UTF-8')); ?> [/php]

And this is the code I am attempting to use:
[php]<?php
$name = ‘’;
$email = ‘’;

$subs = $this->getSubrecords($rec->id);
$subsSize = count($subs);
for($s = 0; $s < $subsSize; $s++) {
$sub = $subs[$s];
switch($sub->name){
case ‘name’:
$name = nl2br(htmlentities(substr($sub->value,0,10000), ENT_QUOTES, ‘UTF-8’));
break;
case ‘email’:
$email = nl2br(htmlentities(substr($sub->value,0,10000), ENT_QUOTES, ‘UTF-8’));
break;
}
}
?>

Name: <?php echo $name; ?> Email: <?php echo $email; ?> [/php]

Any help is sincerely appreciated it is for a great cause so please help. Thank you!

Please could you post the output of:

[php]print_r($this->getSubrecords($rec->id));[/php]

And

[php]print_r($sub);[/php]

Immediately after they are used:

[php]<?php

$subs = $this->getSubrecords($rec->id);
print_r($this->getSubrecords($rec->id));
$subsSize = count($subs);

for($s = 0; $s < $subsSize; $s++) {
$sub = $subs[$s];
print_r($sub);
?>[/php]

Hello jSherz, thank you very much for your reply I apologize for my late one had a busy weekend.

I would post the output if I could but its in pdf and acrobat only allows me to copy 1 line at a time (nightmare).

I’ve uploaded the pdf with the output to one of my friends sites http://www.coastplumbing.com.au/PDF/index.pdf

Using the code below
[php]<?php
$name = ‘’;
$email = ‘’;

$subs = $this->getSubrecords($rec->id);
print_r($this->getSubrecords($rec->id));
$subsSize = count($subs);
for($s = 0; $s < $subsSize; $s++) {
$sub = $subs[$s];
print_r($sub);
switch($sub->name){
case ‘name’:
$name = nl2br(htmlentities(substr($sub->value,0,10000), ENT_QUOTES, ‘UTF-8’));
break;
case ‘email’:
$email = nl2br(htmlentities(substr($sub->value,0,10000), ENT_QUOTES, ‘UTF-8’));
break;
default:
$name = “Oops! Error!”;
$email = “Oops! Error!”;
echo “\n

$sub–>name switch had no name or email values…

\n”;
}
}
?> Name: <?php echo $name; ?> Email: <?php echo $email; ?> <?php } ?> [/php]

These are the fields in my database im trying to reach =\

id record element title name type value
Edit Inline Edit Copy Delete 1 1 180 First Name bfQuickMode1455694 Text Justin
Edit Inline Edit Copy Delete 2 1 195 Last Name bfQuickMode1577299 Text test
Edit Inline Edit Copy Delete 3 1 200 Date Of Birth bfQuickMode6130783 Text 2309123
Edit Inline Edit Copy Delete 4 1 301 Street or P.O. Box bfQuickMode3626431 Text teksjl
Edit Inline Edit Copy Delete 5 1 302 Suburb bfQuickMode7692505 Text 5342k2l3j
Edit Inline Edit Copy Delete 6 1 303 Postcode bfQuickMode6887969 Text 4324lk23
Edit Inline Edit Copy Delete 7 1 304 Home Phone bfQuickMode5689080 Text 4324ljk23
Edit Inline Edit Copy Delete 8 1 305 Parents Mobile bfQuickMode6035469 Text 432ljk4234jl
Edit Inline Edit Copy Delete 9 1 306 Email Address bfQuickMode2534745 Text [email protected]

Any help is much appreciated!

You need to use $sub->title in the switch (not $sub->name).

Sponsor our Newsletter | Privacy Policy | Terms of Service