Welcome to Discuss Everything Forums...

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.


 

Tags for this Thread

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Alex White's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2010
    Posts
    2
    Downloads
    0
    Uploads
    0
    Use quotes like this:

    $result = $_POST["func"];


  2. #2
    abhi's Avatar
    Probation Member

    Status
    Offline
    Join Date
    May 2009
    Posts
    41
    Downloads
    0
    Uploads
    0

    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?

 

 

Quick Reply Quick Reply

Click here to log in


What color is our footer?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 06-04-2011, 11:06 AM
  2. Need PHP Script for a HTML Form.. Please help?
    By srijon00 in forum Discuss PHP
    Replies: 0
    Last Post: 03-16-2011, 05:07 AM
  3. Help with sending HTML form via PHP script...?
    By derekunderwood01 in forum Discuss HTML
    Replies: 0
    Last Post: 02-15-2011, 04:20 AM
  4. Replies: 0
    Last Post: 02-24-2010, 05:33 PM
  5. Replies: 0
    Last Post: 09-10-2009, 08:43 AM

Bookmarks

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •