2014-04-25 3 views
0

PHP로 프로젝트를 만들고 있는데 특정 행의 일부 값을 편집 할 수있는 페이지가 있습니다.텍스트 영역에서 편집 된 값을 어떻게 업데이트합니까?

그래서 이러한 값을 편집하려면 텍스트 상자에 입력하여 편집하고 최종 값을 보내십시오.

<td><input class='txtedit' type='text' name='u_localization[".$val['id']."]' value='".$val['localization']."' /></td> 

내가 텍스트 상자에서 값을 얻고 있고 작동 :

문제

내가 그 일을이 값을 보내고있다는 것이다.

하지만 텍스트 텍스트를 표시하려면 텍스트 영역에서 값을 보내는 방법을 모릅니다. 나는 그것을 사용하지 않는 때문에

<textarea name"namehere"> Value must be here </textarea> 

그리고 난 텍스트 영역에서 값을 얻을 수 없습니다

name="value" 

어떻게 텍스트 영역을 사용하여 값을 업데이트 할 수 있습니까?

+0

당신이 대답을 받으셨어요? 수락 하시겠습니까? – dcromley

답변

0

텍스트 영역에는 특별한 것이 없습니다. 기본적으로 멀티플 입력을 허용하는 것은 단지 <input type="text">입니다.

<textarea name="foo">some random text</textarea> 
       ^^^--- this name 

echo $_POST['foo']; // outputs "some random text" 
+0

텍스트 상자처럼 텍스트 상자를 작동 시키려면 어떻게해야합니까? – user3554221

+0

그렇지 않습니다. 그것이 텍스트 상자와 텍스트 영역이있는 이유입니다. –

+0

Btw 덕분에, 나는 뭔가를 시도 할 것입니다. – user3554221

0

"텍스트 상자"란 입력 텍스트 요소 또는 텍스트 영역 요소를 의미합니까?
입력 텍스트 요소는 자동으로 닫힙니다. "value ="로 초기 값을 가질 수 있습니다.
textareas에는 "value"속성이 없습니다.
두 요소 모두 $ _POST 키가되는 "name"특성을가집니다.

<html> 
<body> 
<form name="formnm" action="forms/form0.php" method="post"> 
Form: 
<fieldset> 
<legend>fieldset</legend> 
InputText: <input type="text" name="textnm" value="initial value" /><br /> 
Textarea: <textarea name="textareanm" rows="2" cols="50"> 
'Twas brillig, and the slithy toves 
Did gyre and gimble in the wabe; 
All mimsy were the borogoves, 
And the mome raths outgrabe. 
</textarea><br /> 
<input type="submit" value="Submit Button" /> 
</fieldset> 
</form> 
</body> 
</html> 
0

텍스트 영역의 내용을 저장하고 필요에 따라 출력합니다.

샘플 양식 :

<?php 

$textAreaContents =<<<'EOD' 
Twinkle, twinkle, little star 
How I wonder what you are. 

Twinkle, twinkle, little star 
How I wonder what you are. 
Up above the world so high 
Like a diamond in the sky 
EOD; 

if (!empty($_POST['textarea1'])) { 
    $textAreaContents = $_POST['textarea1']; 
} 

?> 
<html> 
    <body> 
     <form name="form1" action="" method="post"> 
    <fieldset> 
      <legend>Test of Text Area</legend> 
      <textarea name="textarea1" rows="12" cols="75"><?php echo $textAreaContents; ?></textarea> 
    </fieldset> 
    <fieldset> 
      <legend>Go for it...</legend> 
      <input type="submit" value="Submit Your edits" /> 
    </fieldset> 
</form> 
</body> 
</html> 
관련 문제