Hi,
I am a total noob to PHP. I’m trying to build a listing form for accommodation establishments.
Let me give an example.
On the input side, I have a form, and here’s one of the fields in that form:
Now, the mobile number is not a required field.
But I don’t want the HTML to output blank tags. I’d like the tags to be part of the output, so that if the mobile number is not submitted, it doesn’t display the HTML either.
Here’s what I have on the output side:
if(isset($_POST[‘mobileNumber’])) {
$mobileNumber = $_POST[‘mobileNumber’];
}
I kind of understand what’s going on there. It’s saying that, if a number is received, show a number, but only if a number is received.
I could output the variable such as follows:
Phone number: <?php print $mobileNumber; ?>. (I am trying to use schema.org in my listing.)
But I would like that whole HTML string to be part of the ‘isset’ function.
I hope I’m making myself clear enough.
Could you perhaps help me with this?
Thanks,