簡體   English   中英

根據下拉選擇格式化用戶文本

[英]Format user text based on the drop down selection

我正在嘗試更改用戶輸入的文本的顏色、大小和字體類型。 我無法將這些值傳遞到下一頁。 我嘗試通過 POST 傳遞多個參數,但它拋出了錯誤

<html>
<body>

<form method = "POST" action="ass3_8_output.php">
<textarea id="input" name="input" placeholder="Enter text here" rows="6" cols="50" style="color:'option style'">
</textarea><br><br>

<input type="submit" value="Send"><br><br>
<label for "font color">Font color </lable>
<select id="font color" name="font color">
    <option disabled ="disabled" selected="selected">Select color</option>
    <option style ="color:red" value="Red">Red</option>
    <option style="color:green" value="Green">Green</option>
</select><br><br>

<label for"font type">Select font style </lable>
<select name="font type" id="font type">
    <option value="Lucida Console">Lucida Console</option>
    <option value="Arial">Arial</option>
</select><br><br>

<label for"font size">Select font size </lable>
<select name="font size" id="font size">
    <option value="11">11</option>
    <option value="13">13</option>
</select><br><br>

</form>
</body>
</html> 

php頁面

<?php
//pass name as parameter
$text=$_POST['input'];

echo"$text";
?>

屬性“id”和“name”不能有空格,可以用“-”或“_”代替。 例子:

壞的:

<select id="font color" name="font-color">

好的:

<select id="font-color" name="font-color">

在 PHP 中,您可以使用$_POST['name_of_input']獲取值。

如果需要,請使用var_dump($_POST); die(); var_dump($_POST); die(); 查看從表單發布的所有數據並進行調試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM