php - Submit form values without loading a new page -
i have form using pass values page , working .
is there anyway without opening page form action set?
i think can done using ajax , javascript
echo "<form name=\"android\" method=\"post\" action=\"http://www.example.com\" target=\"_blank\">"; echo "<input type=\"hidden\" name=\"appid\" value=\"$appid\" />"; echo "<input type=\"hidden\" name=\"pushmessage\" value=\"$pushmessage\" />"; echo "<input type=\"hidden\" name=\"username\" value=\"$user\" />"; echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\" />"; echo "<input type=\"hidden\" name=\"publisherid\" value=\"createcoolapps\" />"; //echo "<input type=\"submit\" value=\"push\" name=\"sub\" />"; echo "</form>"; echo "<script> document.forms[0].submit();</script>";
try this:
$url = 'http://www.example.com/'; $fields = array( 'appid' => urlencode($appid), 'pushmessage' => urlencode($pushmessage), 'username' => urlencode($user), 'pass' => urlencode($institution), 'publisherid' => urlencode("createcoolapps") ); foreach($fields $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); $ch = curl_init(); curl_setopt($ch,curlopt_url, $url); curl_setopt($ch,curlopt_post, count($fields)); curl_setopt($ch,curlopt_postfields, $fields_string); $result = curl_exec($ch); curl_close($ch);
Comments
Post a Comment