I have a very basic question about PHP. So, there is index.php that includes a form. This form contains input field field1:
index.php
<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>
I need to use the value from field1 in another PHP file called as processing.php. So, how can I read this value from processing.php? Should I do something like this in processing.php😕
processing.php
$field1value = $_POST["field1"];
The action attribute specifies the URL that the browser will submit to. That is currently
index.php.If you want to use code in
processing.phpto handle the form data, then index must include processing, not the other way around. (As the code stands,processing.phpwon’t be involved at all, so can’t include anything).Alternatively, change the action to point to
processing.php.