jax0n Posted June 27, 2009 Share Posted June 27, 2009 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); } ?> Link to comment https://forums.phpfreaks.com/topic/163930-form-field-value-into-curl-function/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.