Need HTML/PHP(?) help to create a script

Discussion in 'Web Design and Development' started by TodVader, Apr 6, 2008.

  1. TodVader macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #1
    I'll explain my situation:
    One of my sites runs an ebay rss shop. Most pages will have the same layout and id like to create a little script that runs on safari with 4 forms:

    -Page title
    -Page navigation
    -Description (content)
    -RSS URL

    Then, the entries in the 4 above forms would be inserted in the HTML layout at specific places such as between <title> and </title>, etc...

    Id like it to either:

    a)give me the complete HTML/PHP code so I can copy it to Coda
    b)save the file in a .php format

    I have good HTML and basic PHP knowledge but I never did little programs like this.

    If anyone can point me into some kind of direction on how to do this, i'd really appreciate it. Thanks!

    edit: I'm not sure if it was clear but this script will not be used by the users. It's just a little program to help me create the static store pages.
     
  2. Darran macrumors member

    Joined:
    Mar 31, 2008
    Location:
    Singapore
    #2
    From where are you going to be accessing this script? Is it going to be clickable from the RSS Items on your page?

    You would probably need a template on how every page would look like, so it would be easier to just update the necessary values.
     
  3. TodVader thread starter macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #3
    No. I would place it in my local root. It would generate the pages in the root folder. Id upload those pages online after they've been created.

    The script would be offline.

    I have the template. I create the store pages with that template but I'd like an automated process with just 4 forms in a simple browser readable page that would sparse the form entries to the right places in the template.
     
  4. Darran macrumors member

    Joined:
    Mar 31, 2008
    Location:
    Singapore
    #4
    Why do you need to have 4 forms? Can't you combine all the 4 fields together and churn out 1 HTML page in the end?

    You can post the values and when the form is submitted, it will write onto a file with the necessary code. Alternatively, you could have the page display all the HTML code you need, and you can copy and paste it into a file and save it as a htm.

    Hoped I helped you.
     
  5. TodVader thread starter macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #5
    Yeah I mean 4 fields not 4 forms. English aint my main language heh. The entry in the "title" field would go between <title> and </title>, <h1> and </h1>. The Description would go in my description div, the RSS URL would go in my carp code and page specific navigation would go in it's div too.
     
  6. Darran macrumors member

    Joined:
    Mar 31, 2008
    Location:
    Singapore
    #6
    Use the $POST['fieldname'] to get the values in your HTML page and you have your building block. From there you could actually decide which method you want to use to save that html file.
     
  7. TodVader thread starter macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #7
    Ok, I'm pretty advanced in my program but I need to know how to insert the field values in tags. example:

    <?php CarpCacheShow('VALUE'); ?>

    I tried with:

    <?php echo $_REQUEST["rssurl"]; ?>

    but it doesnt work

    It works fine for <title>VALUE</title> and the description which is between <td> and </td>

    And the result I get is a rendered page. I need the all the code in the .php before it gets rendered in safari.

    Here's the form HTLM:
    Code:
    <html><head><title>Test</title></head><body>
    <form action="form1.php" method="post">
    Enter title: <input type="text" name="pagetitle"></input><br>
    Enter description: <input type="text" name="description"></input><br>
    Enter RSS url: <input type="text" name="rssurl"></input><br>
    <input type="submit"></input>
    </form></body></html>
    One last question: How do I make a checkbox inject specific html?
    Example:
    When checking the "special of the week" box, it would insert <img src="special.jpg"> at a specific place? I guess I would use <?php echo $_REQUEST["name"]; ?> like the others but how do I assign that HTML string to the checkbox?

    Thankyou very much for your help
     
  8. Darran macrumors member

    Joined:
    Mar 31, 2008
    Location:
    Singapore
    #8
    You might consider just displaying the code within some <code> tags instead.

    I do not understand what you are asking. If you want to insert HTML, I suppose you could look into DOM.
     
  9. TodVader thread starter macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #9
    Alright I'm done. Thanks for your help, you put me on the right track to learning on various tutorials about the right things.

    I just sent you a PM of a link to the final product.

    This little widget will save me countless hours!
     

Share This Page