PHP POST Code Cleanup
Is there a better way to using post data rather then defining the
variables manually?
My Current Method
<form method="POST" action="form.php">
<input type="text" name="name" id="name" />
<input type="submit" value="Submit">
</form>
<?php
$name = $_POST['name'];
function echoname ($name) {
echo $name;
};
echo "This is my new" . echoname ($name);
?>
Now I know you can just go like this for my example however it is only an
example:
<?php
$name = $_POST['name']
echo "This is my new" . $name;
?>
Is there a better way to use $_POST['value'] without having to define the
post data as a variable every time?
As a note, i have looked here: PHP Manual $_POST already
Thanks!
No comments:
Post a Comment