Please help me , Post Data & Store Data

Please help me , Post Data & Store Data

Page 1 of 1

4 Replies - 1509 Views - Last Post: 23 March 2007 - 04:19 PM Rate Topic: -----

#1 thepolaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 01-February 07

Please help me , Post Data & Store Data

Posted 23 March 2007 - 03:06 AM

Hi guys

want to make a form with 2 actions, means by 1 click 2 actions performs and I do not want to use PHP_SELF, because the first action address is the main target and the second one is to store data

its my code but it doesn't store data in "test.txt" just posts to "http://mysite.com/11.php"
<?php
$st = "
<form action='http://mysite.com/11.php' method='post'>
Name: <input type='text' name='name' />
Age: <input type='text' name='age' />
<input type='submit' />
</form>
";
echo $st;

$name = stripslashes($name);
$age = stripslashes($age);
$logs = fopen('test.txt', 'a', 1);
$mytext="
$name , $age ";

fwrite($logs, $mytext);
fclose($logs);

?>



Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Please help me , Post Data & Store Data

#2 Styx  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 192
  • Joined: 04-March 07

Re: Please help me , Post Data & Store Data

Posted 23 March 2007 - 04:24 AM

Do you have register_globals on?

Right now, you're setting $name and $age by means of automatic variable creation. You should always define your variables:
$name = stripslashes($_POST['name']);
$age = stripslashes($_POST['age']);


Also, you can remove the whole action= part if you're submitting to the current page.

This post has been edited by Styx: 23 March 2007 - 04:25 AM

Was This Post Helpful? 0
  • +
  • -

#3 thepolaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 01-February 07

Re: Please help me , Post Data & Store Data

Posted 23 March 2007 - 05:20 AM

View PostStyx, on 23 Mar, 2007 - 04:24 AM, said:

Do you have register_globals on?

Right now, you're setting $name and $age by means of automatic variable creation. You should always define your variables:
$name = stripslashes($_POST['name']);
$age = stripslashes($_POST['age']);


Also, you can remove the whole action= part if you're submitting to the current page.




no i don't want to submit it to current page
i want to store the datas and after that submit it to another site
Was This Post Helpful? 0
  • +
  • -

#4 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: Please help me , Post Data & Store Data

Posted 23 March 2007 - 07:16 AM

Oh so you want to have someone submit something and then have the script submit that data (or just some data) to another place as if the user went there and did so themselves?

cURL or using fsocksopen() is what you're looking for. I'd try cURL first and then move onto the fsocksopen method as it's harder to accomplish.
Was This Post Helpful? 0
  • +
  • -

#5 thepolaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 01-February 07

Re: Please help me , Post Data & Store Data

Posted 23 March 2007 - 04:19 PM

thanks , it worked ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1