I need a string appended to a variable.

$name = "app200.php";

$string = <form name = "$name" method = "post">

echo "$string";

The result I need is

<form name = [B]"app200.php"[/B] method = "post">

But I am not able to echo the string this way. Any help.
Thanks

$string = "<form name = \"$name\" method = \"post\">";
$string = "<form name = \"$name\" method = \"post\">";

Sorry, but this did not work.

Try this

$name = "app200.php";

$string = "form name = \"$name\" method = \"post\"";

echo $string;
Member Avatar for diafol

Pritaeas has it. The fact that you can't see it may be due to the fact the this tag isn't displayed. Look at view source in your browser and you should see it. If you don't, you've omitted to include something.

Otherwise if you want to display the string in its entirety:

$string = "&lt;form name = \"$name\" method = \"post\"&gt;";

Pritaeas has it. The fact that you can't see it may be due to the fact the this tag isn't displayed. Look at view source in your browser and you should see it. If you don't, you've omitted to include something.

Otherwise if you want to display the string in its entirety:

$string = "&lt;form name = \"$name\" method = \"post\"&gt;";

Thanks. As you say Pritaeas was right. For some reason, it is there in the page source , but is just not displayed. I am just writing it into a file so it does not matter. Your code is displayed in the browser.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.