รบกวนถามครับ ส่งค่าจากradioไปยังphpแต่ไม่สามารถดึงข้อมูลจากdatabase ทำยังไงดี

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

pavich

รบกวนถามครับ ส่งค่าจากradioไปยังphpแต่ไม่สามารถดึงข้อมูลจากdatabase ทำยังไงดี

โพสต์ที่ยังไม่ได้อ่าน โดย pavich »

โค้ด: เลือกทั้งหมด

<?php require_once('control_db/connect.php'); ?>
<?php require_once('control_db/function.php'); ?>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
              <table width="743" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><img src="images/newcarspage/images/selectbrand_head.png" alt="" width="743" height="32" /></td>
                </tr>
                <tr>
                  <td height="59" bgcolor="#f5f5f5"><table width="743" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="2" height="61"><img src="images/newcarspage/images/lefttopline.gif" alt="" width="2" height="61" /></td>
                      <td width="148" valign="bottom" class="radiobrand">&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="brand" id="radio" value="alfaromeo" />
                        <label for="brand">Alfa Romeo</label></td>
                      <td width="148" class="radiobrand">&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="brand" id="radio12" value="ferrari" />
                        <label for="brand">Ferrari</label></td>
                      <td width="148" class="radiobrand">&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="brand" id="radio22" value="lamborghini" />
                        <label for="brand">Lamborghini</label></td>
                      <td width="148" class="radiobrand">&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="brand" id="radio32" value="mitsuoka" />
                        <label for="brand">Mitsuoka</label></td>
                      <td class="radiobrand">&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="brand" id="radio42" value="skoda" />
                        <label for="brand">Skoda</label></td>
                      <td width="2" align="right" valign="top"><img src="images/newcarspage/images/righttopline.gif" alt="" width="2" height="61" /></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td bgcolor="#f5f5f5"><table width="743" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="2"><img src="images/newcarspage/images/leftbottomline.gif" alt="" width="2" height="82" /></td>
                      <td><table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="99" height="46"  align="right" bgcolor="#f5f5f5"><input name="submit" type="submit" class="go" value="GO" /> </td>
                        </tr>
                      </table></td>
                      <td width="2" align="right" valign="top"><img src="images/newcarspage/images/rightbottomline.gif" alt="" width="2" height="82" /></td>
                    </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="4" valign="top" bgcolor="#f5f5f5"><img src="images/newcarspage/images/bottomline.gif" alt="" width="743" height="4" /></td>
                </tr>
              </table>
            </form>
<?php
}
else {
$linkName ="test/show.php?carid=".$_POST["brand"];
header("Location: /$linkName");
}
?>

โค้ด: เลือกทั้งหมด

      <table class="content">
      
     	<?php
		$carid = $_GET[brand];
		if($carid=="")
		alertgo("Please choose brand","test3.php");
		
		
		$sql = "select * from model 
				inner join brand
				on model.carid = brand.carid
				where model.carid = '$carid'
				and mactive = 1
				and car_active = 1";
	
		$get = "carid=$carid";

	$result = mysql_query($sql);
	$num = mysql_num_rows($result);
	
	for ($i=1; $i<=$num; $i++){
		$row = mysql_fetch_array($result);
?>
    <td><form id="form1" name="form1" method="post" action="">
    <table width="300" border="0" cellpadding="0" cellspacing="0" class="modeltext">
      <tr>
        <td align="center"><a href="pimage/large/<?php echo $row[mimage]?>"     name="model"><img src="mimage/small/<?php echo $row[mimage]?>" border="0"/></a>
       </td>
      </tr>
      <tr>
        <td align="center"><?php echo $row[mname] ?></td>
      </tr>
    </table>
</form></td>
<?php if ($i%3 == 0 ) echo "</tr><tr>"; ?>   
<?php } ?>	
</table>		  
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41344
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: รบกวนถามครับ ส่งค่าจากradioไปยังphpแต่ไม่สามารถดึงข้อมูลจากdatabase ทำยังไงดี

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

method ในการส่ง เป็น post ตอนรับก็ต้องเป็น $_POST นะครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ตอบกลับโพส

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 81