0

I coded adding comments function to RSS articles

In the twists and turns, it is in php coding to show and enter comments. However, the input box does not appear. enter image description here

Here is the php code:

$url = "./comments/" . $q.".txt";
//댓글 파일에서 컨텐츠 문자열 가져오기
$txtcomment = file_get_contents($url,true);    
//댓글 나열
echo "<ol>";

if ($q !== "" ) {            
                 $comm = $txtcomment;
                 $arr = [];
                 $arr = explode("--",$comm);
             for ($i=4;$i<count($arr);$i++) {
            echo "<li>".$arr[$i]."</li>";            
       } 
    } else {
    echo "해당기사가 없습니다.";
  }

echo "</ol>";

//중첩검색&결과내 검색 폼 만들기
echo "<br><form class=\"category B\" >
Comment: <input type=\"text\" name=\"comment1\" id=\"comment1\" onkeyup=\"inputComment()\" > 
</form>";

Why? Thank for your concern.

AA Shakil
  • 538
  • 4
  • 14
Drohjho
  • 71
  • 9
  • 3
    use browser developer tools to see if its simply hidden as you not got standard ordered lists so it could be the CSS. Also you can use single quotes in PHP :/ – Lawrence Cherone May 05 '18 at 04:22
  • What's the source code of the page (the HTML _output_ of the script) looking like? – sticky bit May 05 '18 at 04:26
  • @LawrenceCherone Yeah, Thank you for single quotation comment. after now, I'll use that. But, input box is not still. CSS doesn't have hidden function about input tag. – Drohjho May 05 '18 at 04:33
  • @stickybi https://stackoverflow.com/questions/50181624/how-can-variable-and-that-value-move-freely-in-the-cycle-of-php-html-js-php is the previous coding I done. 'Cause Input box is not, I cannot code js inputComment(). – Drohjho May 05 '18 at 04:36
  • @stickybit Sorry, I edited my post. Url is wrong. – Drohjho May 05 '18 at 04:39

1 Answers1

0

Since I use RSS, I presume that php does not properly pass the attributes of the input tag in between. I started to change the old coding.

In other words, I decided that the Show Comments and the input comments were different from the beginning.

getrss.php code as below at first.

echo " <option  id=".$i." onclick=\"showComment".$i."(this.value)\" value=".$item_link4."> Show Comments </option>";

but, I added the input code as like

  echo " <option  id=".$i." onclick=\"showComment".$i."(this.value)\" value=".$item_link4."> Show Comments </option>";
  echo "댓글: <input type='text' name='inputComment' size='200' id='input".$i."' onclick='inputComment".$i."(this.value)' >
              <input type='text' name='txtfile' id='txt".$i."' value=".$item_link4." hidden>
              <div id='comment".$i."'><b>information will be listed here.</b></div>";

And, I make input box as a below picture. enter image description here

In the end, I am trying to solve the problem in a roundabout way. But, I still wonder why ajax's ajax is not working!!

After I input my comment, at once I see that. enter image description here

further coding makes a below picture. enter image description here Thanks a lot for your sharing.

enter image description here

Drohjho
  • 71
  • 9
  • may be their is an error in ajax code, use developer console in browser to see error. – Ammar Ali May 05 '18 at 05:52
  • @AmmarAli Yeah, something may be wrong. But, now my level of knowledge is below that. Someday i will get it. – Drohjho May 05 '18 at 06:25
  • 1
    [https://stackoverflow.com/questions/4623743/display-ajax-response-into-input-field] check this link. – Ammar Ali May 05 '18 at 06:29
  • @AmmarAli Good source! But, I use only javascript not jQuery. Lately, js and Jquery are simultaneously doing in a html page? no Conflicting? – Drohjho May 05 '18 at 06:41