If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
Post a reply to the thread: How do we associate a php script with an HTML form?
Click here to log in
How many letters in the word Rabroad
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.
How do we associate a php script with an HTML form? <HTML> <HEAD> <TITLE>Generic Input Form</TITLE> </HEAD> <BODY> <FORM METHOD="post" ACTION="display_input.php"> <P><strong>Text Field:</strong><br> <TEXTAREA NAME="text1" COLS=45 ROWS=5 WRAP=virtual></TEXTAREA></P> <P><strong>String Functions:</strong><br> <INPUT TYPE="radio" NAME="func" VALUE="md5">get md5<br> <INPUT TYPE="radio" NAME="func" VALUE="strlen">get length of string<br> <INPUT TYPE="radio" NAME="func" VALUE="strrev"> reverse the string<br> <INPUT TYPE="radio" NAME="func" VALUE="strtoupper"> make string uppercase<br> <INPUT TYPE="radio" NAME="func" VALUE="strtolower"> make string lowercase<br> <INPUT TYPE="radio" NAME="func" VALUE="ucwords"> make first letter of all words uppercase</P> <P><INPUT TYPE="submit" NAME="submit" VALUE="Do Something With the String"></P> </FORM> </BODY> </HTML> I have this code which associates to the following php script <?php if(($_POST[text1]=="")||($_POST[func]=="")){ header("Location: remote.html"); exit; } $result = $_POST[func]($_POST[text1]); ?> <HTML> <HEAD> <TITLE>Results</TITLE> </HEAD> <BODY> <?php echo "$result"; ?> </BODY> </HTML> But on pressing the submit button, i get to display_input.php but i get an error saying that the constants 'text1' and 'func' are unidentified. What should i do?
How do we associate a php script with an HTML form?
Use quotes like this: $result = $_POST["func"];
Forum Rules