I have a MySQL database storing some basic user info, so: name, email, and two phone numbers. I want to make a page with dynamic php text showing the users info, but in the database only one phone number is required. On the page I have:
<p id="first"> Some non-dynamic text </p>
<p> <?php echo $row_rsCustomer['first_name']; ?> </p>
<p> <?php echo $row_rsCustomer['email']; ?> </p>
<p> <?php echo $row_rsCustomer['phone_one']; ?> </p>
<p id="phonetwo"> <?php echo $row_rsCustomer['phone_two']; ?> </p>
<p id="second"> Some non-dynamic text </p>
I dont want the #second to be pushed down if the #phonetwo is empty. I was thinking of using some javascript like this:
if( #phonetwo.innerhtml == ""){
#phonetwo.style.display="none";
But I was wondering if there's a way to do this using php? The javascript solution will work I suppose, but I'm pretty sure I've seen somewhere a more "correct" way to do this, I just don't remember what it was nor can I find it anywhere.