양식의 정보를 PHP 코드 블록으로 보낸 다음 텍스트 영역으로 되돌리려면 어떻게해야합니까? 이 대답을 찾을 수 없습니다.<input type = "text">에 텍스트를 보내는 PHP
답변
아주 기본적인 예입니다. http://net.tutsplus.com/articles/news/diving-into-php/
이 추가되었습니다. 두 값을 함께 추가하면 내 결과가 텍스트 영역에 게시됩니다. – daddycardona
@daddycardona 답변을 업데이트했습니다. 그게해야합니까 – JohnP
당신이 자습서는 꽤 나쁜 엉덩이가 지금까지 귀하의 사이트에 대한 감사합니다. – daddycardona
하면 다음 요청에 텍스트 필드에 입력 한 텍스트를 인쇄하려면 :
기초에 대한이 튜토리얼을 살펴 당신이
<?php
$val = 'Nothing in POST';
if (!empty($_POST)) { //$_POST is where stuff posted from the FORM is saved
$val = isset($_POST['text']) ? $_POST['text'] : '';//you're looking for the data with key text which is the name of your textarea element
$val = 'Got something from POST : ' . $val;
}
?>
<form action='index.php' method='post'>
<textarea name='text'><?php echo $val ?></textarea>
</form>
의 index.php라는 이름의 PHP 파일을 가지고 있다고 가정 같은 페이지를 렌더링하는 가정이 같은 (즉 myform.php)을 보일 것이다
<?php
$fieldValue = htmlentities($_POST['myfield']);
?>
<form action="myform.php" method="post">
<label for="myfield">Your textfield:</label>
<input type="text" name="myfield" id="myfield" value="<?php echo $fieldValue; ?>" />
</form>
$ textfieldvalue를 htmlspecialchars로 이스케이프하는 것을 잊지 마세요 –
그래서 이름을 쓰지 않고 대신 ID를 입력하겠습니까? – daddycardona
@Emil Vikström : 그렇습니다. 지적 해 주시면 좋지만 주어진 질문의 범위를 벗어났습니다. – stefanglase
! 당신이 입력 필드에 입력 쳤을 때
$('#input').keypress(function(e){
if(e.wich != 13)//not enter
return;
$.get(your_php_file.php,{param1:val1,param2:val2},function(result){
$('#result').val(result);
});
});
:해야 스크립트에 비해
<input type="text" id="input">
<textarea id="result"></textarea>
: 아약스를 사용하는 (! 그 아약스에 대한 jQuery를 사용)
는이 HTML이 있다고 가정 , 파일을 요청하는 ajax 함수가 호출되고있다your_php_file.php?param1=val1¶m2=val2
. PHP의 결과로, 당신의 텍스트 영역을 업데이트하는 콜백 함수가 호출되고 있습니다.
- 1. Grails가 <input type = "file"
- 2. js를 사용하여 <input type = "file">에 데이터 쓰기
- 3. <input type = "file"/>에 대한 HTML 도우미
- 4. <input type = "text"> 여분의 패딩
- 5. <input type = 'button'/>과 <input type = 'submit'/>의 차이점
- 6. AJAX에서 input type = "button"대신 input type = "submit"하시겠습니까?
- 7. <input type = "tel"> 사용자 정의
- 8. 줄 바꿈으로 <input type = "text"/>
- 9. <button> 대 <input type = "image">
- 10. 동적으로 <input type = "text"/>을 만드는 방법
- 11. HTML - INPUT type = "text"에 SELECT 태그 내용 넣기
- 12. <input type = "file">을 사용하여 로컬 파일 읽기?
- 13. <input type = "checkbox"/> 값을 확인하는 방법은 무엇입니까?
- 14. 이 코드는 작동하지 않습니다 (<input type = "file"/>)
- 15. jQuery set <input type = "range"> 값
- 16. Firefox <input type = "file"/> 호출 jquery val "NS_ERROR_DOM_SECURITY_ERR"
- 17. <input type = "image"/>를 (를) 시뮬레이션하려면 어떻게해야하나요?
- 18. <input type = "range"... 값을 프로그래밍 방식으로 어떻게 변경합니까?
- 19. 지금 <input type = "tel"/>를 사용해도 되나요?
- 20. <input type = 'textarea'onmousemove = 'toscheck()'/>가 Firefox에서만 작동하지 않습니다.
- 21. <input type = file />을 J2EE/MySQL 백엔드에서 사용하기
- 22. <input type = "text"/> 만 입력 할 수 있습니까?
- 23. Html <input type = "password> 태그에 대한 질의 ...?
- 24. 문제 사용자 정의 <input type = "search"...> Jquery Mobile
- 25. 자바 스크립트 .innerHTML이 내 <input type = "file">
- 26. <input type = 'hidden'> 위의 html dtd
- 27. Safari에서 <input type = search>이 도입 된시기
- 28. IE8에서 <input type = "file"> 상자가 회색입니까?
- 29. <input type = "file"/>에 파일 경로를 표시하는 방법은 무엇입니까?
- 30. jQuery : <input type = "file"/>에 대한 클릭 시뮬레이션이 Firefox에서 작동하지 않습니까?
귀하의 질문은 매우 기본적인 것입니다. 내 제안은이 자습서를 따라야 할 것입니다 : http://net.tutsplus.com/articles/news/diving-into-php/ 정말 도움이 될 것입니다 – JohnP
@JohnP 알아요.하지만 내가하려고하는 것은 제 표시입니다. 그 결과 텍스트 상자가되었지만 내가 읽고 읽었던 모든 기본 자습서는 실제로 "문서화 할 것"이라는 에코를 말하는 것으로 표시되지 않았습니다. – daddycardona
에 내가 말한 내용 인 – JohnP