Web lists-archives.com

Re: [PHP] How far out of practice am I? Look inside to find out!




Include takes a path on disk not a URL, and you're passing it
"/includes/..."


On Thu, 28 Apr 2016 at 16:38, Jason Pruim <pruimj@xxxxxxxxx> wrote:

> Hey Everyone,
>
> Been awhile and I"m realizing how out of practice I am! working on creating
> a form, and depending on one of the options, I need to display a file that
> I have stored. The file structure looks like:
> index.php <--- Thats the form
> /includes/
>       file1.inc
>       file2.inc
> etc.
>
> Right now it's straight PHP and HTML, no database, no java, trying to keep
> it simple first! :)
>
> I have $_POST['selPosition'] which will hold the variable of the
> department. Here is the basic code:
>
> I'm using HEREDOC syntax FYI
>
>
> if ($_SERVER["REQUEST_METHOD"] == "POST") {
>
>         if(empty($_POST['txtName'])) {
>
>                 $nameErr = $errMessage;
>
>         }else{
>
>               $name = htmlentities($_POST['txtName'], ENT_QUOTES);
>
>         }
>
>
>         if (empty($_POST['selPosition'])) {
>
>                 $positionErr = $errMessage;
>
>         }else{
>
>               $position = htmlentities($_POST["selPosition"], ENT_QUOTES);
>
>
>         }
>
> }
>
>
>
>
> echo <<<END
>
>         </select>
>
>         <span class="error">{$positionErr}</span>
>
>         </p>
>
>         <p class="showhide">Where will they be working?
>
>                 <select name='selWhereWorking'>
>
>                         <option value=''>Please Choose</option>
>
>                         <option value='OfficeFL'>In office in Gainesville
> FL</option>
>
>                         <option value='OfficeTX'>In office in Dallas
> TX</option>
>
>                         <option value='FromHome'>From their house</option>
>
>                 </select>
>
>         </p>
>         <p class="showhide">When will they start?<input type="text"
> name="txtStart" value="{$startDa$
>
>         Will they be in the corporate office for training the day they
> start?
>
>         <Select class="showhide" name="selTraining">
>
>         <option value="">Please select</option>
>
>         <option value="Yes">Yes!</option>
>
>         <option value="No">No</option></select>
>
>         </p>
>
>         <p class="showhide">Shipping Address: <input type="text"
> name="txtShippingAdd" value="{$ship$
>
>         City: <input type="text" name="txtShippingCity"
> value="{$shippingCity}"> <BR />
>
>         State: <input type="text" name="txtShippingState" size="2"
> value="{$shippingState}">
>
>         Zip: <input type="text" name="txtShippingZip" size="5"
> value="{$shippingZip}"><BR />
>
>         Current Phone Number: <input type="text" name="txtCurrentPhone"
> value="{$currentPhone}">
>
>         </p>
>
>
>         <p>Standard Equipment:</p>
>
> END;
>
> echo "/includes/".$position.".inc";
>
>
> So the file exists in /includes/LES.inc and it populates it properly. I've
> tried echo, I've tried include"/includes/".$position.".inc"; and I can't
> figure out what I'm missing...
>
> Any ideas?
>
> Thanks Everyone!
>