Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8868403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:15:51+00:00 2026-06-14T17:15:51+00:00

I’m trying to send some value from ‘1.php’ page to ‘3.php’ page by using

  • 0

I’m trying to send some value from ‘1.php’ page to ‘3.php’ page by using ‘curl’.

Heres my code-

1.php

<?php
$data = array();
$data['first_name'] = 'hello';
$data['last_name'] = 'Thind';
$data['password'] = 'secret';
$data['email'] = 'me@abc.com';
$post_str =''; 
foreach($data as $key=>$val)
{ $post_str .= $key.'='.$val.'&'; } 
$post_str = substr($post_str, 0, -1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '3.php' );
curl_setopt($ch, CURLOPT_POST, TRUE); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>

3.php

<?php
$host="localhost";       
$dbname="mr"; 
// mysql code for table= create table m(name varchar(10));
$username="";            
$password="";
$con=mysql_connect("$host","$username","$password")or die("cannot connect");
mysql_select_db($dbname) or DIE('cannot select db');
if(isset($_POST['first_name'])){
$name=$_POST['first_name'];
$sql="insert into m
values('$name')";
$sq=mysql_query($sql);
echo"ok";
}
mysql_close($con);
?>

My problem is “No data is inserted into database cause no data is transfered to 3.php from 1.php” .I checked database code in ‘3.php’ by giving some value and that was inserted correctly into database.So code in ‘3.php’ works well.So it seems the code in ‘1.php’ not working.

(Note: php_curl.dll is activated in php.ini file. I’m using windows xp professional service pack-2, xampp-win32 version-1.8.1)

Can anybody please tell me whats wrong there ?

-Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:15:52+00:00Added an answer on June 14, 2026 at 5:15 pm

    curl_setopt($ch, CURLOPT_URL, '3.php' );

    This requests the URL 3.php…
    You must give it some “hints” as cURL is an external program that will simply call the URL as is.

    Change it to something like http://mysite.whatever/3.php


    On a side note, cURL is a command-line utility and it’s way easier to debug if used that way. You should first test-it command line and then, if it’s workign, implement it on your PHP code.

    Mode on cURL here: http://curl.haxx.se/docs/manpage.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.