Jump to content

Recommended Posts

<?php 
<label>Tel:</label>
<div>' . $row['tel'] . '</div>
<label>Address:</label>
<div>'. $row['address'] . '</div>
<div>' $row['county'] . . $row['state'] . '</div>
<div>'. ['zip'] . '</div>
?>

 

 

I have a parse error in this line

<?php <div>' $row['county']  . $row['state'] . '</div>?>

 

Help!

Link to comment
https://forums.phpfreaks.com/topic/188086-appending-several-indexes-help/
Share on other sites

You cant place HTML code within PHP tags. You need to use echo or print.

 

<?php 
echo '<label>Tel:</label>
<div>' . $row['tel'] . '</div>
<label>Address:</label>
<div>'. $row['address'] . '</div>
<div>'. $row['county'] . $row['state'] . '</div>
<div>'. ['zip'] . '</div>';
?>

PHP does not understand HTML, therefore you can't place raw HTML within the php tags. You need to use echo (or print) to send the html to the browser, as I showed you in my previous post:

<?php 
echo '<label>Tel:</label>
<div>' . $row['tel'] . '</div>
<label>Address:</label>
<div>'. $row['address'] . '</div>
<div>'. $row['county'] . $row['state'] . '</div>
<div>'. ['zip'] . '</div>';
?>

I have taken out the html and done it like this now.

 

<?php 
    Tel:' . $row['tel'] . ' <br/>
Address:'. $row['address'] . '<br/>
        '. $row['county'] .  $row['state'] . '<br/>
        '. $row['zip'] . '<br/>
?>

 

That appending works but how can I put a commar in between county and state?

 

Something else I want to know how can I put an space so that county, state and zip display below the address? like.

       

        Tel: 978-450-2321

Address: 2334 sedwick ave.

              Worcester, ma

                01561

 

how can I reach a display just like the above withou html tags?

 

thank you.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.