Link to home
Start Free TrialLog in
Avatar of jeremyBass26
jeremyBass26Flag for United States of America

asked on

Trying to split?

Hello, So I have this that I'm trying to come back to... it's an old question that no one was "able" to answer for me...

I have two things
{emps_grd:{row|0,employer|asdfasdf,address|asdfasdf,phone|asdf,supervisor|asdf,contact|false,wage|,duties|,from|Mon Jun 2 00:00:00 GMT-0700 2008,to|,reason|},{row|1,employer|new Employee,address|asdfasdf,phone|,supervisor|asdfadf,contact|false,wage|asdfasdf,duties|,from|Tue Jun 3 00:00:00 GMT-0700 2008,to|Thu Jun 19 00:00:00 GMT-0700 2008,reason|}}

{jobs_picks:{Job_Pick`0|CNA - MEDICAL UNIT},{Job_Pick`1|Unit Secretary / CNA Mental Health Center},{Job_Pick`2|CREDIT COUNSELOR},{Job_Pick`3|UNIT SECRETARY - ICU/PCU},{Job_Pick`4|CNA - SURGICAL UNIT},{Job_Pick`5|CNA - SURGICAL UNIT}}

each need to be ???split???

the out put I'm looking for is

CNA - MEDICAL UNIT<br/>
Unit Secretary / CNA Mental Health <br/>
etc...
for the job picks

(I'm betting this is more straight forward, I just have not getting it to work yet)

and

employer : asdfasdf<br/>
address : asdfasdf<br/>
phone  :asdf<br/>
supervisor : asdf<br/>
contact : false<br/>
wage :<br/>
duties :<br/>
from : Mon Jun 2 00:00:00 GMT-0700 2008<br/>
to :<br/>
reason : <br/>



the plan is to then take the empsgrd and make reason into Reason etc...

it's going into an area like this

      <tr>
        <td><?= $m9feu_input__APPz_emps_grd;?>
<span>(1) Employer and Address
            <br/>Job Title and Duties </span></td>
        <td><span>Dates of Employment
            <br/>From To
            <br/>Final Salary $ </span></td>
        <td><span>Name of Supervisor Phone # May we contact? <br/>Yes______  No ______ Reason for Leaving </span><br/></td>
      </tr>

so I'm thinking that if i ??split it then I can run it through a loop and output <tr> after <tr> until there are no more "rows" left....

I hope that makes sense... Please If it does not please let me know I'll try to clear the air...

I'm open to any ideas... but this is one of those questions I need examples of working models and the how it works... As I really don't get the key things or  well here is the old question...
https://www.experts-exchange.com/questions/23531863/make-HTML-tables-out-of-a-complexe-array.html
Should prove I don't get this end of it to well... which is why the examples are needed...

Thank you for the help here... I sure need it on this... Have a great one...
jeremyBass
ASKER CERTIFIED SOLUTION
Avatar of marchent
marchent
Flag of Bangladesh image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jeremyBass26

ASKER

Thank you for the quick response... Is that the best way to do this?  Should I be slpiting this or doing something else...

Thanks again
jeremyBass
Actually it depends upon your choice and the project spec. I thought this one will be easier. Other coder may find spliting or any other approaches are easier than my one. Depends on the view of coder.
got ya... I'll try it out and get back... thanks for the help here...
jeremyBass
So I think it's all good but I can't fully tell....so could you please show me how to fix this part so I can fix the other...

this is what i did

$data = $m9feu_input__APPz_jobs_picks;
if(preg_match_all('/\|(.*?)\}/', $data, $match)){
    $match = $match[1];
    foreach($match as $str){
       $dataOUT = $str . "<br/>\n";
    }
}

<?= $dataOUT?>

but all I'm getting out is the very last one...  I'm I missing sonthing here?  Thanks for the help on this...

jeremyBass

the area of the script
$data = $m9feu_input__APPz_jobs_picks;
if(preg_match_all('/\|(.*?)\}/', $data, $match)){
    $match = $match[1];
    foreach($match as $str){
       $dataOUT = $str . "<br/>\n";
    }
}
 
ob_start();
?>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<div>
  <h1><span>APPLICATION FOR EMPLOYMENT </span></h1><span><span>Date of Application </span><? echo 'Now:       '. date('Y-m-d, H:i') ."\n"; ?></span><br/>
  <div>
    <table>
      <tr>
        <th> <span>Indicate Position(s) Desired </span><br/><br/><?= $dataOUT?><span> </span></th>

Open in new window

Ok so I figured out how to echo it out to the pdf...

problem though...
$m9feu_input__APPz_emps_grd = "{row|0,employer|Employer 3,address|sdf,phone|,supervisor|,contact|,wage|,duties|,from|,to|,reason|},{row|1,employer|Employer 2,address|,phone|,supervisor|,contact|,wage|,duties|,from|,to|,reason|},{row|2,employer|Contact,address|,phone|,supervisor|,contact|,wage|,duties|,from|qwqwqw,to|rerererer,reason|xcvxcv}";
$dataEMPS = $m9feu_input__APPz_emps_grd;
<? if(preg_match_all('/\{row\|\d+,(.*?)\}/', $dataEMPS, $match)){
    $match = $match[1];
    foreach($match as $str){
        $str = preg_replace('/\|/', ":", $str);
        $str = preg_replace('/,/', "<br/>\n", $str);
        echo " $str \n";
    }
}?>

that just outputs nothing I think... well it's blank... any ideas?... thanks for the help here...
jeremyBass
:) so I fixed it... it was a line error above all this so that's why the issue... you were spot on... thanks for the hhelp here ... have a great one today...
jeremyBass
:) so I fixed it... it was a line error above all this so that's why the issue... you were spot on... thanks for the help here ... have a great one today...
jeremyBass