Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Create new page on the same web server in PHP

So, I’m trying to create a blogging website, where everyone can post a blog on the website, and that would create a new webpage. I have searched all over the internet for this, but i can not find it for some reason…

HTML:

<form name="bloginput" action="blogpost.php" method="POST" class="bloginputform">
    <input type="text" name="bloginput" placeholder="Type your blog here..." id="bloginput" class="bloginput">
    <div class="popup">
    <input type="button" placeholder="Submit" id="popupbtn" onclick="toggleHideShow()">
    <span class="popuptext hide" id="myPopup">
        <input type="name" name="author" placeholder="Name:" id="nameinput" class="nameinput">
        <br>
        <input type="email" name="authoremail" id="emailinput" placeholder="E-mail..." class="emailinput">
        <br>
        <label class="filelabel" id="filelabel">
            <input type="file" name="post-image" accept="image/*" id="fileinput" class="fileinput">
            <p class="fileinputtext" id="fileinputtext">
                Upload Image:
            </p>
        </label>
        <p><button class="crossbtn" onclick="toggleHideShow()" id="crossbtn">âś•</button><input type="submit" value="Post" placeholder="Post" class="submitbtn" id="submitbtn"></p>
    </span>
</form>

What I have so far in my PHP file:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<?php
    $blogtext = $_POST["bloginput"];
    $author = $_POST["author"];
    $email = $_POST["authoremail"];
    $image = $_POST["post-image"];
    header("Location: http://blogmedia.nl/make")
?>

You can find all of this on http://blogmedia.nl

>Solution :

Your code doesn’t create any new page, it just displays data that it have received from the form.

Please, search examples by keywords "Creating simples blog on PHP+MYSQL".
Your code on PHP should include at least a connection to the existing database,
at least one INSERT statement to save new data in the database, and error checks (that data before insertion was valid and database saved data successfully). To display data, you should use SELECT statement to receive latest data or list of all posts in the database.

Examples how to work with the database via mysqli (documentation)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading