need help creating form

Discussion in 'Programming' started by wboster, Jun 26, 2009.

  1. #1
    I'd like to create a form that will put a line of text into a few lines of html code. With multiple variables.

    Like this:

    Keyword1 = good
    Keyword2 = day

    text = <p>Have a {INSERT KEYWORD1 HERE} {INSERT KEYWORD2 HERE}.</p>


    Can anyone recommend a site that will show me how to do this? or just send me to a site that has done something similiar and I can just view source and read the code.

    thanks,
    -Wes
     
    wboster, Jun 26, 2009 IP
  2. meknassi

    meknassi Well-Known Member

    Messages:
    671
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #2
    let the form send keywords to a php file.


    after that use this code in your php file

    $kw1=POST['txt1']; // txt1  is the name of the 1st text field in your form
    $kw2=POST['txt2']; // txt2  is the name of the 2nd text field in your form
    echo " text = <p>Have a",$kw1 $kw2,".</p> ";
    PHP:
     
    meknassi, Jun 26, 2009 IP
  3. Rask

    Rask Active Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Rask, Jun 26, 2009 IP
  4. kiddo

    kiddo Peon

    Messages:
    243
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Have a <span id="keyplace1"></span><span id="keyplace2"></span>.
    
    <input type="text" id="keyword1" />
    <input type="text" id="keyword2" />
    <button onClick="update()">Update</button>
    
    <script>
    function update(){
    var keyword1 = document.getElementById("keyword1").value;
    var keyword2 = document.getElementById("keyword2").value;
    
    document.getElementById("keyplace1").innerHTML = keyword1;
    document.getElementById("keyplace2").innerHTML = keyword2;
    }
    </script>
    Code (markup):
     
    kiddo, Jun 28, 2009 IP