SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    1. Here is my code:

    Code:
    <?php
    include("config.php");
    
    $get_guestbook = "SELECT data.ID as ID, data.Name as Title, header, format, footer, records_per_page, " .
    " allow_posting, allow_multiple, require_name, require_email, require_content, admin_name, admin_email, " .
    "guestbook.ID as PostID, GID, Email, Homepage, Content, Date, guestbook.Name as Name " .
    "FROM data, guestbook WHERE data.ID=GID AND data.ID=$id ORDER BY Date DESC";
    
    
    $do_get = mysql_query($get_guestbook);
    if (!$do_get) {
    print "At this time the guestbook cannot be located.";
    } else {
    while ($result = mysql_fetch_array($do_get)) { 
    
    
    $items[] = array("ID" => $result["ID"],
    "Title" => $result["Title"],
    "Header" => $result["header"],
    "Footer" => $result["footer"],
    "Format" => $result["format"],
    "Records_per_page" => $result["records_per_page"],
    "allow_posting" => $result["allow_posting"],
    "allow_multiple" => $result["allow_multiple"],
    "require_name" => $result["require_name"],
    "require_email" => $result["require_email"],
    "require_content" => $result["require_content"],
    "admin_name" => $result["admin_name"],
    "admin_email" => $result["admin_email"],
    "PostID" => $result["PostID"],
    "GID" => $result["GID"],
    "Email" => $result["Email"],
    "Content" => $result["Content"],
    "Date" => $result["Date"],
    "Homepage" => $result["Homepage"],
    "Name" => $result["Name"]);
    
    }
    
    for($i=0;$i<1;$i++) {
    $Header = $items[$i]["Header"];
    $Header = stripslashes($Header);
    echo("$Header");
    
    }
    
    for($i=0;$i<1;$i++) {
    $Posts = $items[$i]["Records_per_page"];
    
    }
    
    
    ?>
    <br>
    <?php
    
    if ($Posts == 0) {
    foreach($items as $key => $val) { 
    
    $Format = $items[$key]["Format"];
    $Format = stripslashes($Format);
    $Format = str_replace("{Date}", $items[$key]["Date"], $Format);
    $Format = str_replace("{Email}", $items[$key]["Email"], $Format);
    $Format = str_replace("{Homepage}", $items[$key]["Homepage"], $Format);
    $Format = str_replace("{Name}", $items[$key]["Name"], $Format); 
    $Format = str_replace("{Content}", $items[$key]["Content"], $Format); 
    print $Format;
    
    }
    } else {
    
    for($i=0;$i<$Posts;$i++) {
    $Posts = $items[$i]["Records_per_page"];
    $Format = $items[$key]["Format"];
    $Format = stripslashes($Format);
    $Format = str_replace("{Date}", $items[$key]["Date"], $Format);
    $Format = str_replace("{Email}", $items[$key]["Email"], $Format);
    $Format = str_replace("{Homepage}", $items[$key]["Homepage"], $Format);
    $Format = str_replace("{Name}", $items[$key]["Name"], $Format); 
    $Format = str_replace("{Content}", $items[$key]["Content"], $Format); 
    print $Format;
    }
    }
    ?>
    <br>
    <?php
    
    
    
    
    for($i=0;$i<1;$i++) {
    
    $post = $items[$i]["allow_posting"];
    
    }
    
    if($post == 1 ) {
    ?>
    
    <form method="post" action="?<?php echo $PHP_SELF; ?>">
      <table width="49%" border="0" cellspacing="0" cellpadding="3">
      <tr> 
        <td width="24%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Name:</font></td>
        <td width="76%"> 
          <input type="text" name="name">
        </td>
      </tr>
      <tr> 
        <td width="24%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Email:</font></td>
        <td width="76%"> 
          <input type="text" name="email">
        </td>
      </tr>
      <tr> 
        <td width="24%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Homepage:</font></td>
        <td width="76%"> 
          <input type="text" name="homepage">
        </td>
      </tr>
      <tr> 
        <td width="24%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Comment:</font></td>
        <td width="76%">&nbsp; </td>
      </tr>
      <tr> 
        <td colspan="2"> 
          <textarea name="comment" cols="40" rows="5"></textarea>
        </td>
      </tr>
      <tr> 
        <td width="24%"> 
          <input type="submit" name="Submit" value="Submit">
        </td>
        <td width="76%">&nbsp; </td>
      </tr>
    </table>
    
    </form>
    <?php
    }
    
    for($i=0;$i<1;$i++) {
    
    $Footer = $items[$i]["Footer"];
    $Footer = stripslashes($Footer);
    print $Footer;
    
    }
    
    } #Last SLASH that must exist
    
     ?>
    2. Here is my problem: In the $Header field, if I enter PHP code like a varialble or something it doesn't get shown properly.

    Say the $Header contains: $progtitle
    That is a variable in the config file. However, visit the page that has the code above, i'll get the word: $progtitle on the page.

    If I do:

    <?php print $progtitle; ?> or
    <?php $progtitle; ?>

    It prints nothing, EXCEPT, when I look at the source code it is in there. Now how do I make it accept PHP?

    Any Ideas at all?

    Thanx

    Peter

  2. #2
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, obvious stuff first.

    PHP is installed on the server?
    The file is named .php and not something like .php.txt or just plain old .htm?

    Enclosed in <? and ?>?

    I'm out...

  3. #3
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Yes

    2. Yes

    3. What do you mean, I tried it (as said) and it is displayed in the source code.

    -Peter

  4. #4
    Freelance Web Designer KeithMcL's Avatar
    Join Date
    Oct 1999
    Location
    Dublin, Ireland
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by petesmc
    Say the $Header contains: $progtitle
    That is a variable in the config file. However, visit the page that has the code above, i'll get the word: $progtitle on the page.
    What kind of variable is $progtitle?

    Have you tried defining $progtitle instead and seeing if that get's printed on the page?

  5. #5
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I just type:

    print $progtitle;

    It does defintely print it on the page, it is text.

  6. #6
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by petesmc
    1. Yes

    2. Yes

    3. What do you mean, I tried it (as said) and it is displayed in the source code.

    -Peter

    Well excuse me for breathing!

    I can't think of anything else, sorry.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •