Jump to content

[SOLVED] Text fields


Schlo_50

Recommended Posts

I have seen some websites that have dynamic forms which do things like add extra text fields when you click + field much like what this website does: http://www.mredkj.com/tutorials/tableaddcolumn.html

 

I know that these websites use javascript but is this not at all possible in PHP?

I have had a go although it has not been that successfull, i'll post what i have just so that you can see it and maybe ammend it if this idea is possible.

 

<?php
print "<form action=\"$_SERVER[php_SELF]\" method=\"post\" name=\"addfields\">";
$newfield = print "<input type=\"text\" name=\"add_1\" id=\"add_$num\" />";
print "<br />";
print "<input class=\"text\" type=\"submit\" name=\"add\" value=\"Add Field\" />";

if (isset($_POST['add']))
{
$strtnum[1] = 1;
$newfield = "<input type=\"text\" name=\"add_1\" id=\"add_$num\" />";
$num = count($strtnum, $newfield);


print "<p>";
print "<label>";
print "<input type=\"text\" name=\"add_1\" id=\"add_$strtnum\" />";
print "<br />";
print "</label>";
print "</p>";
print "<p>";

print "</p>";
print "<p>";

print "</p>";
print "<p>";
print "</form>";
print "</p>";

}
?>

 

Error: Warning: count() expects parameter 2 to be long, string given in C:\apachefriends\xamp.. on line 19

 

Any help or suggestions guys? Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/80604-solved-text-fields/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.