Jump to content

appending several indexes help.


co.ador

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.