PHP echo and formatting help

Discussion in 'PHP' started by gamma911, May 12, 2008.

  1. #1
    Hi there,

    I stumbled on these forums and hope someone can help.

    I would like to create a very simple page where users can enter information in text boxes and upload images and then when they click submit the text should be outputted on screen as valid xhtml with each textbox being styled as the script is coded todo

    So for instance if the form has

    text box : first box text
    text box : Second box text
    Image: Image

    Rendered page

    <p style="padding-right: 6px; padding-left: 6px; padding-bottom: 4px; color: #ffffff; padding-top: 2px; background-color: #e26e6e; border: #f6b5b5 2px solid">
    <strong>first box text</strong>
    </p>
    <p style="padding-right: 6px; padding-left: 6px; padding-bottom: 4px; color: #555555; padding-top: 2px; background-color: #f4ff9f; border: #ffe29f 2px solid">
    <strong>Second box text</strong><br />
    <br />
    </p>
    <img src="image.jpg" border="0" alt="" width="399" height="299" />


    Any help with examples would be appreciated.
    Regards
     
    gamma911, May 12, 2008 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    -_- i think this is html? table formatting
     
    bartolay13, May 12, 2008 IP
  3. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OK first, put all that CSS in a stylesheet. =)

    Second, as far as the form
    // check to see if the form has been submitted
    if(isset($_POST['submit'])) {
     // error check
     if(!empty($_POST['value'])) {
      // do something with the information - insert, upload, etc
      // then display the information
      echo("<p>".$_POST['value']."</p>");
     }
    } 
    // the form hasn't been submitted
    echo("<form method='POST'>");
    // the rest of the form elements
    
    Code (markup):
     
    Altari, May 13, 2008 IP