javascript - Is there any php code to allow access on a page just from homepage? otherwise redirect to home -


hello guys im new php, maybe question simple.
wanna know if there way redirect users open www.example.com/page.php www.example.com
if try open page www.example.com , no redirects , page loads completly.
have on home page has button on , when users click button enters www.example.com/page.php
dont want users access www.example.com/page.php without clicking on button.
can show me example php codes?

one way use conditional statement on page.php check if data has been posted (value of button).

code -

<?php  if ( (!isset($_post)) && ($_post['buttonname'] != 'postedbuttonvalue' )){     header('location: http://www.example.com');     exit(); }  // continue script below...  ?> 

Comments