[Solved] How do i add space between this php variables


You’re generating invalid HTML. This:

'<option value=". $spName . " ' . $spPro .'>'
                             ^--- WITH the added space

Will produce something like this:

<option value=SomeName SomeProfession>

The browser has no way of knowing that these two values are part of the same attribute. In short, you forgot the quotes. You want to generate something like this:

<option value="SomeName SomeProfession">

So put the quotes in your code:

'<option value="'. $spName . ' ' . $spPro .'">'

In short, always look at the actual HTML that’s in your web browser when debugging this. Don’t just look at what ends up in the database somewhere downstream in the system, but look at the actual steps which lead to that downstream result. Invalid HTML is often fairly obvious to see when you look at the HTML itself.

1

solved How do i add space between this php variables