0

I'm trying to make an link that when clicked redirects to a php page called din.php and makes use of another php page called coleta2 to put some data inside a table in database. I tried to put coleta2 as a value in the href but didn't work, tried to put as two <a> tags but also didn't work, any ideas to do this? The coleta2.php don't have any html is just an if that puts the data.

<a href="din.php?tipo=1&tab=tb_locaisac" class="fund" value="coleta2.php?tipo=1&estado=ac">Locais turisticos de Rio Branco</a></a>

I get this error:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\wamp64\www\novo\logado\locais\din.php:160) in C:\wamp64\www\novo\logado\locais\coleta2.php on line 2

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
  • Why not just use `include 'coleta2.php';` in your din.php file? – Brad Nov 04 '17 at 20:55
  • i put this on the din.php but now i'm getting this error: – Pedro H Ferreira Nov 04 '17 at 21:05
  • Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\wamp64\www\novo\logado\locais\din.php:160) in C:\wamp64\www\novo\logado\locais\coleta2.php on line 2 – Pedro H Ferreira Nov 04 '17 at 21:05
  • in line 2 there is a session start only – Pedro H Ferreira Nov 04 '17 at 21:06
  • If you get the error "headers already sent" that means things are in the wrong order in your PHP file. Everything that sends HTTP headers (i.e. info about the document) must come before the HTML data (i.e. the document itself). – Mr Lister Nov 05 '17 at 14:11

1 Answers1

1

Use PHP'S include method above the doctype.

Do as so: include('coleta2');

  • i didn't get this, it's like calling the page like calling an script or css? this line of code will reapet 3 times in the page with different var's. – Pedro H Ferreira Nov 04 '17 at 20:33
  • ok i put this include insede the other php page and it worked but there is one error that appear on the html page, and i don't know what to do: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\wamp64\www\novo\logado\locais\din.php:160) in C:\wamp64\www\novo\logado\locais\coleta2.php on line 2 – Pedro H Ferreira Nov 04 '17 at 20:43
  • At the top of the page you are working with, you need to include this code at the top of the document as such: `` –  Nov 05 '17 at 00:16