What exactly are you trying to do?
If you just need to post parameters then you only need to create a simple HTML form and have it post to the PHP file.
The PHP file can then process the POST parameter and then forward to a new URL or URI if applicable.
<form method="post" action="/someFile.php">
<fieldset>
<label for="qq-30">Label</label>
<input type="text" id="qq-30" name="qq-30" value="" />
</fieldset>
<fieldset>
<input type="hidden" value="3e18aa789cc3dae98656dad64857214e57fad630" name="csrf">
<input type="submit" value="Submit">
<input type="reset" title="Reset the form?" value="Reset">
</fieldset>
</form>
<?php
// Define valid post data
$validPostData = array();
// Set valid post data
$validPostData['question_30'] = isset($_POST['qq-30']) ? sanitizeString($_POST['qq-30']) : NULL;
// Do whatever with your valid post data here
// redirect to external site:
header('Location: http://newsite.com');
// or you can do this for local redirects
header('Location: /localFile.php');
/**
* Sanitizes the string
* - All strings are forced to UTF-8 encoding
* @param string $string
*/
function sanitizeString($string) {
return htmlentities( (string) $string, ENT_COMPAT, "UTF-8" );
}
?>
This is a very simple and bland way of handeling form data.
You need to first identify how you want to handle the form data/submission.
The redirect is easy to apply (just remember that no output can be sent to the user else the header() method will fail).
Let me know if this helps and try to clarify what you are trying to accomplish. :)
Note: you will see I have a hidden field called csrf... this is from my form system to prevent cross-site requests forgery... you may want to look into this as it is really easy to prevent and is a big problem for most web forms.
Edited by SoN9ne, 16 November 2011 - 12:09 PM.