Code: Select all
$_POST['name1']Moderator: General Moderators
Code: Select all
$_POST['name1']Code: Select all
$_POST['name1'];Code: Select all
$_GET['name1'];Code: Select all
$_POST['name1']Code: Select all
echo '<HR><PRE>'; print_r($_POST); echo '</PRE>';Code: Select all
alert("<?php echo $_POST['name1']; ?>")Code: Select all
<script language="JavaScript">
<?php
if(isset($_POST['field_1'])){
echo 'alert("' . $_POST['field_1'] . '");';
}
?>
</script>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="form1">
<input name="field_1" type="text" value="some value">
<input name="Submit" type="button" value="Submit">
</form>Javascript has access to it's specific host-browser's DOM (i.e. Document Object Model) which is slightly different from browser to browser. That is why you can access e.g. "form1.name1.value" at runtime and get a value back immediatly. Because Javascript can access the browser's DOM and in fact is part of the browser, it's a client-side language.twooton wrote:is there anyway to get the value at form1.name1.value without having to use the $_POST['name1']. such as just getting an alert box to pop up and say its name:The code above obviously never works, but somethign to that extent.Code: Select all
alert("<?php echo $_POST['name1']; ?>")