2015-07-10 62 views
3
<!doctype html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <title>ssc prepartion</title> 
    </head> 

    <body><form action="ssc.php" method="post"> 
    1 
    <input name="name" type="text"> 
    <input name="submit" type="submit"value="result"></form> 
    </body> 
</html> 
// creating php file to get the result. 
<?php 
    $name=$_REQUEST["name"]; 

    $text="user".$name; 
    echo'<form action="ssc1.php" method="post">'; 
    for($x =0; $x <= $name; $x++) { 
    echo '<label for="'. $name .'">'.$x.'</label>'; 
     echo '<input type="text" name="'.$text.'" ><br><br>'; 
    } 

    echo'<input type="submit" value="result">'; 
    echo'</form>'; 
?> 

所以在這裏我想通過一個小的PHP函數來創建輸入字段。它正在工作並創建輸入字段,但問題在於創建這些輸入字段之後。使函數創建自動輸入框

我不知道如何給這些輸入字段命名或標識以及如何從所有創建的字段獲取值。

我的問題是我們如何在創建這些全部後從這些輸入字段接收值?

+0

你想做什麼?你想在JS或PHP – Raghavendra

回答

0

使用php,在ssc1.php頁面上可以使用$ _POST ['Name of input']獲得輸入值]

+0

我們可以用PHP來做到這一點 –