Jump to content


Photo

help me


  • Please log in to reply
1 reply to this topic

#1 tranphuongit

tranphuongit
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 April 2006 - 05:43 PM

I have file exp.html.php:

<form name="question" method="post">
<input type="hidden" name="content" value="10">
</form>

<?php
$a=document.question.content.value;
?>


I want $a=10, how? thank

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 30 April 2006 - 06:03 PM

Simple as:

$a = (int) $_POST['content'];

or this way, can determine if form post was a get or post:

$a = (int) ('GET' == strtoupper($_SERVER['REQUEST_METHOD'])) ? $_GET['content'] : $_POST['content'];


Assumes you want it to be an integer value.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users