/    Sign up×
Community /Pin to ProfileBookmark

PHP Newbie with a few basic questions

I’ve been going through the PHP tutorials and getting the gist of things, however I do have a couple basic questions.

  • 1.

    Where do you put the code in relation to the rest of the code? Is PHP separated like CSS is? Or is it within the body with the html?

  • 2.

    If I’m making a form, how does the PHP code fit into that? Where?

  • Does anyone have an example of basic well-formatted, easy-to-read PHP code along side html. Just to give me an idea?

    Thanks so much.

    to post a comment
    PHP

    7 Comments(s)

    Copy linkTweet thisAlerts:
    @bokehMar 10.2007 — Is PHP separated like CSS is?[/QUOTE]It should be completely separate although many people's coding skills are very amateurish and they have a hard time not mixing their logic and output sections. A well written PHP script will not output anything until any logic sections have been completely concluded.
    Copy linkTweet thisAlerts:
    @owossoauthorMar 10.2007 — Thanks so much Bokeh!

    By separate, do you mean not within the body content? Rather, above it in the head like CSS code is? So I would have my php code, then </head>. Then <body> html, forms, etc. </body>

    Or, do you mean the php is within the body but separated from the form? Such as <form> </form> <? ?>

    Thanks again!
    Copy linkTweet thisAlerts:
    @bokehMar 10.2007 — No, it doesn't work like that. PHP code is run on the server so in theory it should come before the DOCTYPE.
    Copy linkTweet thisAlerts:
    @owossoauthorMar 10.2007 — Thanks again.

    I think I have that figured out. Now, I have another question:-)

    I'm following this tutorial for the form - I've found it the most simplistic and self explanatory.

    http://www.freewebmasterhelp.com/tutorials/php/6

    However, I still have one confusion. Are there supposed to be TWO files/documents for this form? If so, what do each of the two files do?

    What I want to do is create a form where viewers can offer their opinion and their comment will be emailed to me. That's it.

    Here's my site:

    http://www.adunate.com/kitchenComments.php
    Copy linkTweet thisAlerts:
    @owossoauthorMar 10.2007 — OK. I know I'm an idiot about this. But I may be getting somewhere!!

    So, am I right in this thinking? The comment page is a separate html page which contains the form? The action within that form is directed to a separate corresponding php page?

    That's what I did and it seems to work. I even got the email.

    http://www.adunate.com/kitchenComments.html

    Now, my question is. Can the response page, the one the viewer gets after submitting a comment, be a small pop up? Or does it have to come up at all?

    Thanks so much for your help. I learn so much from these forums!
    Copy linkTweet thisAlerts:
    @bokehMar 10.2007 — Don't use that tutorial, it's crap.
    Copy linkTweet thisAlerts:
    @owossoauthorMar 10.2007 — Thanks so much! What one do you suggest? Like your tagline, I need it simple! I'm stupid:-)
    ×

    Success!

    Help @owosso spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.9,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...