How do I get the $code variable value into the Function from the Form textbox
if that textbox "name" field value is pulled from my Db and not always the same.
thx..
<?php
require_once("db.php");
$sql = "SELECT * FROM table";
$res = mysql_query($sql);
while($row = mysql_fetch_array($res)) {
$vals["url"] = $row['url'];
$vals["name"] = $row['name'];
?>
<form action="<?php echo $row['url'];?>" method="post">
<input type="text" name="<?php echo $row['name'];?>">
<input type="submit" name="submits" value="Submit">
</form>
<?php
if(isset($_POST["submits"])) {
post_form($vals);
}
}
function post_form($vals) {
$url = $vals["url"];
$code = "(this is the value I need to get from the FORM TEXTBOX above)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('url'=>$url, 'code'=>$code, 'submit'=>'Submit'));
$result = curl_exec($ch);
print($result);
curl_close($ch);
}
?>