PHP Snippets

<?php include("filename.html"); ?>

Session variables:

if ($Debug) print " # Before change QueryModelsFilter(Session) =".$_SESSION['QueryModelsFilter']." # ";   
//if (isset($QueryModelsType) || $QueryModelsType <> "")
//    $_SESSION['QueryModelsFilter']= "ManType";
//    if (isset($QueryModelsMan) || $QueryModelsMan <> "")
//        $_SESSION['QueryModelsFilter']= "Man";
//    else
//        $_SESSION['QueryModelsFilter']= "All";

if ($QueryModelsAll || !isset($_SESSION['QueryModelsFilter']))
    $_SESSION['QueryModelsFilter']= "All";
    if ($QueryModelsMan)
        $_SESSION['QueryModelsFilter']= "Man";
        if ($QueryModelsManType)
            $_SESSION['QueryModelsFilter']= "ManType";



Checkbox on data items


<input type='checkbox' name='YourFieldName[]' value=\"$DataBaseValue\"

Then in the script that recieves the form POST or GET data, cycle
through the array of checkbox values and do with them as you will.

foreach($YourFieldName as $val)
//echo checkbox values to the page or do whatver you will with
echo "checkbox value: $val";

Action confirm box using Javascript: (thanks

if (isset($_GET['action']) && isset($_GET['record']) )
    $RecordId = htmlspecialchars($_GET['record']);
    $Action = htmlspecialchars($_GET['action']);
    echo 'You are ready to delete ID: '.$RecordId;
    # CODE for delete records
<script language="javascript" type="text/javascript">
function deleteRecord(RecordId)
    if (confirm('Delete this Record?')) {
        window.location.href = 'index.php?action=deleteRecord&record=' + RecordId;
Item 1 <a href="javascript:deleteRecord('1001');">DELETE
Item 3<a href="javascript:deleteRecord('1003');">DELETE
Item 15 <a href="javascript:deleteRecord('1015');">DELETE



Jump to a bookmark on page load:


<script type="text/javascript">

function goToAnchor() {
location.href = "myPage.html#myAnchor";