我當前的PHP代碼是:想從HTML獲得價值到PHP
<?php
header('Content-type: image/jpeg');
$jpg_image = imagecreatefromjpeg('Desert.jpg');
$white = imagecolorallocate($jpg_image, 73, 41, 236);
$font_path = 'OpenSans-Italic.TTF';
$text = $_GET['name'] ;
imagettftext($jpg_image, 25, 0, 75, 50, $white, $font_path, $text);
imagejpeg($jpg_image);
imagedestroy($jpg_image);
?>
這是完全的工作我使用$_GET['name']
獲得來自輸入標籤的用戶文字輸入在HTML中的名字是name="name"
和現在我想從組合框中獲取值
我的組合框的html代碼:
<select name="gender" id="gender" class="form-control input-lg" maxlength="12">
>
<option value="male">male</option>
<option value="female">female</option>
</select>
當我試圖讓從$_GET['gender'];
值圖像上未顯示用戶選擇的值。幫幫我!
我已經試過這也
<?php
header('Content-type: image/jpeg');
$jpg_image = imagecreatefromjpeg('Desert.jpg');
$white = imagecolorallocate($jpg_image, 73, 41, 236);
$font_path = 'OpenSans-Italic.TTF';
$text = $_GET['name'] ;
$text2= $_GET['gender'];
imagettftext($jpg_image, 25, 0, 75, 50, $white, $font_path, $text);
imagettftext($jpg_image, 25, 0, 80, 60, $white, $font_path, $text2);
imagejpeg($jpg_image);
imagedestroy($jpg_image);
?>
但
@ Fred-ii-我已編輯它 – learner
在打開PHP標記之後立即將錯誤報告添加到文件頂部例如'<?php error_reporting(E_ALL);例如: ; ini_set('display_errors',1);'然後你的代碼的其餘部分,看看它是否產生任何東西。另外,你正在使用表單標籤,對吧? –
@learner,爲什麼額外的'>'在你的'select'內? –