jnvnsn Posted July 25, 2011 Share Posted July 25, 2011 Any ideas on how to determine the name and company name in this format: John Doe John Doe Home Services 4748 National Rd E, Richmond, IN 47374 (765) 962-3908 johndoe@email.com www.johndoe.com Name: John Doe Company Name: John Doe Home Services Address: 4748 National Rd E, Richmond, IN 47374 Tel. No.: (765) 962-3908 Email: johndoe@email.com Url: www.johndoe.com I have a way in determining the tel. no., email url. Ideas anyone? Quote Link to comment https://forums.phpfreaks.com/topic/242744-address-parser/ Share on other sites More sharing options...
wildteen88 Posted July 25, 2011 Share Posted July 25, 2011 What are you wanting to do? Are you wanting to convert John Doe John Doe Home Services 4748 National Rd E, Richmond, IN 47374 (765) 962-3908 johndoe@email.com www.johndoe.com in to this format Name: John Doe Company Name: John Doe Home Services Address: 4748 National Rd E, Richmond, IN 47374 Tel. No.: (765) 962-3908 Email: johndoe@email.com Url: www.johndoe.com . Where is this data coming from? And have you made any attempt at doing this yourself? Post your code here within or tags. Quote Link to comment https://forums.phpfreaks.com/topic/242744-address-parser/#findComment-1246766 Share on other sites More sharing options...
jnvnsn Posted July 25, 2011 Author Share Posted July 25, 2011 I'm not trying to convert anything. I'm just trying to know if there is a way to determine the name through it's company name with this format: John Doe John Doe Home Services 4748 National Rd E, Richmond, IN 47374 (765) 962-3908 johndoe@email.com www.johndoe.com What im trying to do here is store this in a database through this field: Name Company Name Address Tel. No. Email Url Quote Link to comment https://forums.phpfreaks.com/topic/242744-address-parser/#findComment-1246779 Share on other sites More sharing options...
wildteen88 Posted July 25, 2011 Share Posted July 25, 2011 Yes, you can use explode combined with list to place each line into variables. Example code <?php //the data $data = 'John Doe John Doe Home Services 4748 National Rd E, Richmond, IN 47374 (765) 962-3908 johndoe@email.com www.johndoe.com'; // standardise newlines to \n character $data = str_replace(array("\r\n", "\r"), "\n", $data); // put each line into variables list($name, $companyName, $companyAddress, $telNumber, $email, $website) = explode("\n", $data); ?> <!-- display the data --> <b>Name</b>: <?php echo $name; ?><br /> <b>Company Name</b>: <?php echo $companyName; ?><br /> <b>Address</b>: <?php echo $companyAddress; ?><br /> <b>Tel. No.</b>: <?php echo $telNumber; ?><br /> <b>Email</b>: <?php echo $email; ?><br /> <b>Url</b>: <?php echo $website; ?> Quote Link to comment https://forums.phpfreaks.com/topic/242744-address-parser/#findComment-1246784 Share on other sites More sharing options...
jnvnsn Posted July 26, 2011 Author Share Posted July 26, 2011 Thank You wildteen88! Quote Link to comment https://forums.phpfreaks.com/topic/242744-address-parser/#findComment-1247307 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.