2012-03-04 9 views
0

テキストボックスの値を変数に割り当てる方法を教えてください。ここでテキストボックスの値を変数に割り当てる方法を教えてください。

は私のフォームです:

<form id="" method="post" action="photo_upload.php" enctype="multipart/form-data"> 
<table align="center" cellpadding="0" cellspacing="0" border="0" width="650px"> 
    <tr> 
    <td colspan="7"> 
    <input type="text" id="albumName" name="albumName" value="jaghamachi"/> 
    </td> 
    </tr> 
    <tr> 
    <td width="50px" align="center"/> 
    <td align="center" width="100px">Upload Pics::</td> 
    <td align="center" width="50px"/> 
    <td align="center" width="200px"> 
     <input type="file" id="file" name="file"/> 
    </td> 
    <td align="center" width="50px"/> 
    <td align="center" width="100px"> 
     <input type="submit" name="submit" id="submit" value="submit" class="button" style="width: 100px;" /> 
    </td> 
    <td align="center" width="50px"/> 
    <tr> 
    <td height="16px"/> 
    </tr> 
    </table> 
    </form> 
<?php 
// here i want a code similar to string str = Text1.Text like in .net; 
//i want a code smthng like this 
//$value= albumName.value; how to do it?? here albumName is the textbox type in above form 
?> 

それはjavascriptやjqueryのを使用せずに、行うことができますか?

答えて

1

あなたはこのようにそれを行うことができます。ここでは

$albumName = $_POST['albumName']; 

  • $albumNamealbumName
  • $POSTという名前のテキストボックスの値を含む変数名はフォームメソッドPOST例えば<form method="POST"
  • です

注1:仕事のことについてはは、あなたが最初にフォームを送信することが想定されます。

注2:が同じページに送信するには、

0

フォームを掲示されて行うことができる唯一のこと、そして$_POST

+0

彼から値を空にしaction属性<form>タグのセットそうでなければ、質問はしていないだろうか分からない、OPはより良い説明が必要:) – Sarfraz

関連する問題