Claim your Biolink Click Here
1 like 0 dislike
1.3k views
in Education & Reference by | 1.3k views

1 Answer

0 like 0 dislike
Best answer

on Index.php

<?php

if($_POST['id1']=='add')

{
$data=$_POST['user'];

$ch = curl_init();
$user="ssss";
$pwd=$data;
curl_setopt($ch,CURLOPT_URL,  "http://127.0.0.1/curl/data.php/?");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&pwd=$pwd");
$buffer = curl_exec($ch);
if(empty ($buffer))
{ echo " buffer is empty "; }
else
{ echo $buffer; }
curl_close($ch);
}
?>
<form name="data" id="data" method="post">
<input type="text" value="" id="user" name="user"  />
<input type="submit" name="id1" id="id1" value="add" />
</form>

on data.php

<?php
mysql_connect("localhost","user","pwd") or die(mysql_error());
mysql_select_db("DBname") or die("not connected to db");



$arr_insert = array(

"user"         => $_POST['user'],
"pwd"         => $_POST['pwd']

);
insertData($arr_insert,ADMIN);


########### USED TO FIRE THE INSERT QUERY
function insertData($arr, $tableName) {
$query = "";        

if(! is_array($arr) ) {
die("ERROR: Invalid Operation.");
}
foreach($arr as $key => $value ) {
$query .= "`$key`='$value',";           
}
$query = " insert into $tableName set ".substr($query, 0, -1);
mysql_query($query) ;
return mysql_insert_id(); ######## RETURNS LAST INSERTED ID
} # END OF FUNCTION

?>
by
0 0
great info..thnx.. :)

Related questions

0 like 0 dislike
2 answers
1 like 0 dislike
1 answer
asked Oct 10, 2013 in Education & Reference by Neha (1.1k points) | 1.3k views
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
asked Jan 4, 2018 in Education & Reference by Sam (1.6k points) | 1.1k views
0 like 0 dislike
1 answer
asked Aug 1, 2017 in Education & Reference by Krish (1.1k points) | 493 views
0 like 0 dislike
1 answer
asked Jul 7, 2014 in Education & Reference by Bhoomika (-30 points) | 27.4k views
0 like 0 dislike
1 answer
asked Apr 18, 2014 in Education & Reference by Yogi (460 points) | 222 views
1 like 0 dislike
1 answer
asked Apr 15, 2014 in Education & Reference by Yogi (460 points) | 283 views

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,310 questions
1,471 answers
569 comments
4,809 users