Good day. There is one question. I wrote some kind of script that I enclose:

Connect to base

$db = mysql_connect("localhost","root","") or die("Could not connect: " . mysql_error()); 

We pull out the base


We take out the table with values

 $result = mysql_query("SELECT kod,model FROM phones",$db); $myrow = mysql_fetch_array($result); 

We display all data in an ordered form.

 echo "Ваш номер телефона: ".$subno. "<br /> Код товара: ".$myrow["kod"]. "<br />Модель телефона: ".$myrow["model"]; 

We write the record from the database to a variable for sending to another script.

 $s = $myrow["kod"]; 

We form the link


Display link

 echo "<a href=".$data.">File.php</a>" 

Everything works great. But in order for the data to be transmitted, I need to follow the link. And you can not make them automatically transmitted. And I opened the file and saw in it the variables I needed?

    1 answer 1


     header("Location: file.php?var=$s&var2=privet"); 

    Call up any other output.


     print '<script type="text/javascript">window.location='."file.php?var=$s&var2=privet".'</script>'; 


     if( $curl = curl_init() ) { curl_setopt($curl, CURLOPT_URL, 'file.php?var=$s&var2=privet'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); $out = curl_exec($curl); echo $out; curl_close($curl); } 
    • This is what it says: Warning: Cannot modify header information - headers already sent by (output started at C: \ Open-server \ domains \ localhost \ script \ testing.php: 8) in C: \ Open-server \ domains \ localhost \ script \ testing.php on line 32 - shoms
    • > Call before any other conclusion. I wrote. Before this line there should be neither prints, nor html inserts. Even spaces are impossible. If it doesn't work at all, you can stuff js code: print '<script type = "text / javascript"> window.location ='. "File.php? Var = $ s & var2 = privet". '</ Script>'; but it is a crutch. - knes
    • They still talk with the cURL something you can stir up ... - shoms
    • can. But for this, this module must be and you must have access to it. if ($ curl = curl_init ()) {curl_setopt ($ curl, CURLOPT_URL, 'file.php? var = $ s & var2 = privet'); curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, true); $ out = curl_exec ($ curl); echo $ out; curl_close ($ curl); } - knes