0

I create my HTML this way

 $('<form>')
     .attr('method',"POST")
     .attr('action',"postMetier.php?metier="+"<?php echo $GET['metier'] ?>")

How can I make the echo work ?

pavel
  • 26,538
  • 10
  • 45
  • 61
goldiman
  • 189
  • 2
  • 13

2 Answers2

1

$GET variable doesn't exists, correct name is $_GET.

.attr('action',"postMetier.php?metier="+"<?php echo $_GET['metier'] ?>")
                                                     ^

Of course, you JS code has to be in PHP file (or other which is parsed by server).

pavel
  • 26,538
  • 10
  • 45
  • 61
1

it is not $GET['metier'] but $_GET['metier'], if there is value recieved on your page by get method then echo $GET['metier'] will give you some value.

Note: if $GET['metier'] is your defined variable, then it should have some value in it so that it can be echoed.

Sourabh Kumar Sharma
  • 2,864
  • 3
  • 25
  • 33