Connect it all together

To start with, make sure you have XAMPP installed on your computer.

MAC

Open the program and turn on MYSQL and APACHE

Windows

Windows

CMND + SPACE

type htdocs

Go to file window

go to applications folder

go to xampp folder

double click htdocs

MACS

Move the file I sent you to the htdocs folder

Windows

In Sublime, click open, then select the folder you want to open.

In Sublime, select open folder then select the folder you want to open.

MACS

Move the file I sent you to the htdocs folder

In your browser, go to

 

localhost/shout_out_php

Remove the comments from line 7

And reload the browser

Nice Form!

<form action='submit.php' method='post'>

</form>

Nice Form!

<form action='submit.php' method='post'>
    <input type='text' name='teacher_name' placeholder='Your Name'>

</form>

Nice Form!

Now create the rest of your form

Nice Form!

Now create an input for Grade Level

Nice Form!

Text

                <select name='school_id' class='form-control'>
                    <?php
                    foreach($schools as $school){
                    ?>
                        <option value='<?= $school['school_id'] ?>'>
                            <?= $school['school_name'] ?>
                        </option>
                    <?php  
                    }
                    ?>
                </select>

Final Product

Text

<form action='submit.php' method='post'>
    <input class='form-control' type='text' placeholder='Your Name' name='shout_out_author'>
    <input class='form-control' type='text' placeholder='Grade Level' name='grade'>
    <textarea class='form-control' name='shout_out_text'></textarea>
    <select name='school_id' class='form-control'>
        <?php
        foreach($schools as $school){
        ?>
            <option value='<?= $school['school_id'] ?>'>
                <?= $school['school_name'] ?>
            </option>
        <?php  
        }
        ?>
    </select>
    <input type='submit' value='submit'/>
</form>

The Shout Outs

Text

<?php foreach($sos as $shout_out){    ?>

    <?= $shout_out['shout_out_text']; ?>

    <?= $shout_out['shout_out_author']; ?>
        
<?php  }    ?>

Connect it all together

By Ryan York

Connect it all together

  • 1,283