Drohjho
Drohjho

Reputation: 71

In PHP, How I can put variable into php codes which are composed of HTML?

I want to put my global variable into echo code in php. My code is below.

<?php
global $result;

code { 
 ...
  }

$result;
//중첩검색&결과내 검색 폼 만들기
echo "<form class=\"category 2\" name=\"search\" action=\"display.php\" onsubmit=\"return validateForm()\" method=\"get\">     
Input: <input type=\"text\" name=\"search\" id=\"qstra\" onkeyup=\"showUsera()\" > 
 // Next line is something wrong!!!!!!!!!!!!!!!!!!!!!!!!!!
<input type=\"text\" name=\""?><?php $result ?><?php "\" id=\"pstra\" onkeyup=\"showUsera()\" > 
***//I want to have name = $result from global.*** 
</form>
<div id=\"hint1\"><b>information will be listed here.</b></div>";

?> 

I am a weak php programmer. Please give me a piece of advice.

Upvotes: 1

Views: 54

Answers (1)

Rp9
Rp9

Reputation: 1963

Use php string concatenation

<input type=\"text\" value=".$result." name=".$result." id=\"pstra\" onkeyup=\"showUsera()\" 

Upvotes: 1

Related Questions