2012-03-04 3 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 
?> 
가 자바 스크립트 또는 jQuery를 사용하지 않고 할 수있는 방법

?

답변

1

당신은 이런 식으로 작업을 수행 할 수 있습니다 여기에

$albumName = $_POST['albumName']; 

:

  • $albumNamealbumName
  • $POST라는 이름의 텍스트 상자의 값을 포함하는 변수 이름은 양식 방법 POST 예를 들어 <form method="POST"
  • 입니다

참고 1 : 작동하려면 먼저 양식을 제출해야합니다.

주 2 :가 같은 페이지에 제출하려면,

0

양식을 포스팅 할 수있는 유일한 것은, 그리고 $_POST

+0

그는에서 값을 비워 action 속성 <form> 태그 세트 그렇지 않으면 질문하지 않았을지 모르겠지만, OP는 더 나은 설명이 필요합니다 :) – Sarfraz

관련 문제