2012-07-23 4 views
0

다른 PHP 페이지에 값을 전달하기 위해 다음 코드를 시도했지만 아무 것도 얻지 못했습니다.PHP 파일에 값을 건네기

파일 이름 : Send.html

<form id="form1" action="get.php" method="get"> 
<input name="search_name" type="text" id="search_name" size="20.5" height="45" border="#770074" > 
<select name="mydropdown" width="230" STYLE="width: 180px" size="0" "height: 200px"> 
<option value="All">All Categories</option> 
<option value="Childrens Clothing">Childrens Clothing</option> 
</select> 
<img src="../img/search.jpg" width="70" height="45" border="0" align="left" usemap="#Map"> 
</form> 

<map name="Map"> 
<area shape="poly" coords="5,35" href="#"> 
<area shape="rect" coords="-5,8,140,45" href="get.php"> 
</map> 

파일 이름 : Send.html에서 </form> 전에 get.php

<?php 
$sname=$_GET['search_name']; 
$cname=$_GET['mydropdown']; 
echo $sname."<br>".$cname; 
?> 
+2

양식을 제출하는 방법은 무엇입니까? (제출 버튼이 보이지 않습니다.) – grammar31

+1

링크를 클릭하면 (즉, 이미지 맵에서) 양식을 게시하지 않습니다. – mellamokb

+1

이미지 맵에서 링크를 사용하고 있습니까? 그게 효과가 없을거야. 적절한 제출 버튼이 필요하거나 자바 스크립트를 사용해야합니다. – JJJ

답변

0
<img onclick="document.getElementById('form1').submit();" src="../img/search.jpg" width="70" height="45" border="0" align="left" usemap="#Map"> 
0

적절한 버튼을 제출 추가 <input type="submit" value="Submit" />를 추가합니다.

이미지를 사용하려면 편집 , 당신은 할 수 있습니다 :

<button type="submit"><img src="..." /></button> 
0
<area shape="rect" coords="-5,8,140,45" onclick="document.form1.submit();"> 

이것은 당신이 특정 영역 만 원하는 webarto의 대답에 약간의 편집 생각하기 때문에 이미지를 제출 버튼으로 사용합니다.