Please help me with this issue. I am trying to echo out 7 or 8 input types.
The input types must have 2 values from my database.
The Arrays are called : $adressX[] and $adressY. and are automatically loaded when the webpage loads.
So when number is 0 , i want to create a input type with the value : ($adressX[0],$adressY[0]).
I keep getting parsing errors , this being my first project on php/javascript.
Please help me.
My code is like this.
<?php
for ($number=0;$number<=$array_no-1 ;$number++)
{
echo '<input type="text" id="inputtype"."$number"
value="".$adressX['.$number'],".$adressY['.$number']">';
};
?>
You were messing up your quotes and periods. Try this:
You should read up on how PHP handles quotes and concatenation, but here are a few examples to get you started.
If you want to start the string with a single quote, you must end/concatenate the string with a single quote as well. Like this:
Similarly, if you start with double quotes, you have to end/concatenate with double quotes, like this:
Notice the last example,
$string3. When using double quotes, you can put variables inside the quotes and PHP will still parse them; however, I don’t condone this and I ALWAYS concatenate so when using an IDE with syntax highlighting it is obvious where the variables are.Here is an example of putting the same type quotes in the string that you start/end the string with. To do this, you must use a slash () to tell PHP that these should be parsed as regular quotes instead of delimiters.
Lastly, here is an example of an HTML string in PHP. I usually start these strings with single quotes so that I can use the conventional double quote delimiters for the HTML.