提交后抛出的php变量

时间:2017-10-09 12:22:01

标签: php html

  form action="espmusicpurchase.php" method ="POST">
  <b><label for="cname">Your Name</label></b>
  <br>
  <input id = "cname" name = "cname"/>
  <br><br>
  <b><label for="address">Billing Address</label></b>
  <br>
  <input id = "address" name = "address" type="text" />
  <br><br>
  <b><label for="email">Email Address</label></b>
  <br>
  <input id = "email" name = "email" type="text" />

  <br>
  <br>
  <input id = "submit" size=20px name = "submit" type="submit" value = "Submit" class="button" />
  </form>  <!--this is just here for you to see what i want to do, no changes needed for the above-->



  <?php
  session_start();
  $name = $_GET['gname'];//the code gets pulled from the previous page here and is working
  $Price = 10000;
  if (isset($_POST["submit"])) //this is where the trouble seems to come from, it throws the old data away
  {


$email = $_POST["email"];
$address = $_POST["address"];
$cname = $_POST["cname"];



$InsertSQL = "insert into purchase values('".
            $cname."','".
            $name."','".//there is nothing in here
            $address."','".
            $email."','".
            $Price."')";//this is for some reason 0
$rs = mysql_query($InsertSQL,$Con); 

        }   
  ?>

你可以看到它不会添加名称和价格,我在代码中添加了注释,以便您了解我想要的内容。当我按下提交时,$ name和$ price不会添加。我理解会话的一些问题,但我还需要添加它

0 个答案:

没有答案