PHP에 관해 매우 기본적인 질문이 있습니다. 따라서 양식이 포함 된 index.php
이 있습니다.PHP : 입력 필드의 값 읽기
의 index.php 내가 processing.php
로 불리는 또 다른 PHP 파일에 field1
에서 값을 사용할 필요가
<div id="container1">
<form name="optform" method="post" action="processing.php">
<div class = "box">
<label for="field1"><span>Bla bla bla:</span></label>
<input type="text" class="input-text" value="5" size="11" maxlength="11" name="field1" id="field1">
</div>
<br/>
<div class="buttons">
<a href="" class="regular" onclick="click_function();return false;">Run</a>
</div>
</form>
</div>
<div id="container2">
</div>
<script language="javascript">
function click_function() {
$('#container2').load('processing.php');
}
</script>
:이 양식은 입력 필드 field1
가 포함되어 있습니다. 그렇다면이 값을 processing.php
에서 어떻게 읽을 수 있습니까? processing.php
에서 이렇게해야합니까?
processing.php
$field1value = $_POST["field1"];
index.php에 processing.php를 포함시키고 POST가 설정된 조건에서 코드를 실행하십시오. 이것은 하나의 옵션입니다. processing.php에 폼 액션을 설정하고 다시 인덱스로 리디렉션 할 수도 있습니다. – cen