-3
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Introduction Process</title>
</head>

<?PHP
$window_width=0;

$window_width= '<script>window.screen.availWidth</script>';

if $window_width <= 500 {
    $Link = "SignUp.php";
}
else{
    $Link = "1stPage.php";
}
?>

<Body>
<center><img src="Alex.png" alt="" align="middle"></center>
<center><div>Hello, I am Alex. I am here to walk you through an 11 question quiz which will help calculate your resilience level.</div></center>

<FORM NAME ="form1" METHOD ="POST" ACTION =<?PHP echo $Link; ?>>

<center><INPUT TYPE = "Submit" class=myButton Name = "Submit1"  VALUE = "Start"></center>
</FORM>


</body>
</html>

I am trying to test for the size of a screen so i know whither or not to send them on to my mobile website or to a full sized website, I am getting this error "Parse error: syntax error, unexpected '$window_width' (T_VARIABLE), expecting '(' in C:\wamp64\www\IntroductionProcess.php on line 12"

  • Well for one thing that's now how you write an `if` statement. And for another, ***JavaScript DOES NOT RUN on the server!*** – Niet the Dark Absol Aug 02 '16 at 13:44
  • 1
    You don't need PHP for this. You can simply use HTML. Have a look [here](https://developers.google.com/webmasters/mobile-sites/mobile-seo/separate-urls). – Drew Kennedy Aug 02 '16 at 13:44

1 Answers1

0

First off, you should research how to write JavaScript if statements. As to how to get the screen size, screen.height and screen.width should give you the screen dimensions, using only JavaScript. Within 2 minutes of searching, I found your answer in this question. Please do more researching next time you have a problem instead of instantly asking a question.

Community
  • 1
  • 1
Neil A.
  • 841
  • 7
  • 23