Jump to content

Hellusius

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Posts posted by Hellusius

  1. I made a CSS class

    [CODE].backgroundlayer  {
                      height: 100%;
                      width: 800;
                      background-color: #EFDFC9;
                      margin: 0px 0px 0px 0px;
                      padding: 0px 0px 0px 0px;
                      text-align: center;
                      text-vertical-align: top;
                      }[/CODE]

    And all other site content is within this table class, but the align doesn't seem to work.

    Am I doign something wrong?
  2. I know this has no real relevance, but I would like to ask why this does not work.
    I wanted to echo each number from 0 to 20

    [code]<?php
    function hello ($amount=25)
    {
      for ($i = 0; $i < $amount; $i++)
      return $i;
    }
    ?>

    <?php
    echo (hello($i));
    ?>[/code]
  3. bumped into a new problem now

    [code]<?php
    if (isset($_POST['submit'])) {
      // collect data sent from form but ONLY if it was submitted
      $name = $_POST['name'];
      $age = $_POST['age'];
      $sex = $_POST['sex'];

      // connection variables
      $host = "******"; // almost inavariably
      $db_name = "details";
      $db_user = "******";
      $db_pass = "******";
      $db_table = "details";

      // connect to host and select db
      mysql_connect($host, $db_user, $db_pass);
      mysql_select_db($db_name);

      // create and execute the query to insert data
      $query = "INSERT INTO $db_table (id, name, age, sex) VALUES ('', '$name' , '$age' , '$sex')";
      $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); // in case it bombs
    ?>
    <center>
    <table width="500" bgcolor="000000" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td>
    <font color="1055AA" size="3">Infromation has been added, <a href="/index.php">click here</a> to return to the homepage</font>
        </td>
      </tr>
    </table>
    </center>
    <?php
    } else {
    ?>

    <form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "post">
    Enter your name: <br />
    <input type = "text" size = "40" name = "name" /><br />
    Enter your age: <br />
    <input type = "text" size = "3" name = "age" /><br />
    Enter your sex: <br />
    <input type = "text" size = "1" name = "sex" /><br /><br />
    <input type = "submit" name = "submit" value = "Add Data" />
    </form>


    <?php
    }
    ?>[/code]

    it gave me this error

    [quote]Error: No database selected with query INSERT INTO details (id, name, age, sex) VALUES ('', 'test' , '00' , 'v')[/quote]

    I know its something with that line, but I can't see what, any help is very much appreciated
  4. I made a database with a few things, just to take a peak at how things work, but I already stranded, I made a database, which I connected to and I made a few forms so you can insert a row into the database, this is the coding

    [code]<form action = "/postit.html" method = "post">
    Enter your name: <br />
    <input type = "text" size = "40" name = "name" /><br />
    Enter your age: <br />
    <input type = "text" size = "3" name = "age" /><br />
    Enter your sex: <br />
    <input type = "text" size = "1" name = "sex" /><br /><br />
    <input type = "submit" value = "Add Data" />
    </form>
    <?php
    // collect data sent from form
    $name = $_POST['name'];
    $age = $_POST['age'];
    $sex = $_POST['sex'];

    // connection variables
    $host = "*****"; // almost inavariably
    $db_name = "*****";
    $db_user = "*****";
    $db_pass = "*****";
    $db_table = "details";

    // connect to host and select db
    mysql_connect($host, $db_user, $db_pass);
    mysql_select_db($db_name);

    // create and execute the query to insert data
    $query = "INSERT INTO $db_table (id, name, age, sex) VALUES ('', '$name' , '$age' , '$sex')";
    $result = mysql_query($query);
    ?>[/code]

    Did I forget something, cause nothing is being added to the database in my oppinion
  5. I am trying to sum two variables, but it gives me the following error

    [code]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/warnicro.awardspace.com/stats.php on line 3[/code]

    The php code is

    [code]<?
    echo "<font color=\"#EFDFA0\">Statistics<br />;
    $count = file_get_contents("count.txt");
    $count2 = file_get_contents("count2.txt");
    echo "<font color=\"#EFDFA0\">Homepage views: ".trim($count);
    echo "<font color=\"#EFDFA0\">Total page view: ".trim($count) + ($count2);
    ?>  [/code]

    Anyone see what I am doing wrong?
  6. I want to start learning how to use databases on sites, cause I can make them via "myphpadmin" page but I really have no clue how to use it really, like for instance how to make a register page to my site so people can register and etc.

    Now my question is, what is the best place to start reading about it, I know HTML properly, CSS more than enough, Javascript till certain extent, and very limited php.
  7. I looked up some code for a mailing page, so people can instant mail to the contact mail of the website, but it does not really work.

    so far I got
    [code]<?
    if ($_POST["email"]<>'') {
    $ToEmail = 'harold_break@hotmail.com';
    $EmailSubject = 'Contact us';
    $mailheader = "From: ".$_POST["email"]."\r\n";
    $mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
    $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
    $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>";
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
    ?>
    Your message was sent
    <? } else { ?>
    <form action="contactus.php" method="post">
    <table width="400" border="0" cellspacing="2" cellpadding="0">
    <tr>
    <td width="29%" class="bodytext">Your name:</td>
    <td width="71%"><input name="name" type="text" id="name" size="32"></td>
    </tr>
    <tr>
    <td class="bodytext">Email address:</td>
    <td><input name="email" type="text" id="email" size="32"></td>
    </tr>
    <tr>
    <td class="bodytext">Comment:</td>
    <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
    </tr>
    <tr>
    <td class="bodytext">&nbsp;</td>
    <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
    </tr>
    </table>
    </form>
    <? }; ?>[/code]

    I can send the mails, but they do not arrive into the mail, is there something I am doing wrong?

    thanks for your time
  8. I made this little script in the head

    [code]< script language="JavaScript">
    <!-- Page counter
    var Count=20;

    Function increaser( )
    {
    onload="Count= Count + 1";
    }

    page counter -->
    < /script>[/code]

    and this little document.write in the body part

    [code]< script language="JavaScript">
    document.write("Total page views: " + Count + "<br />");
    < /script>[/code]

    but nothing is being displayed, when I only do the text, it does but whenever I add the variable it doesn't anymore
  9. I am making a slideshow

    Script: (in head of file)
    [code]<script language=javascript>
    <!-- Slideshow script
    var slide = new Array("TR(trailer)0.jpg","TR(trailer)1.jpg","TR(trailer)2.jpg","TR(trailer)3.jpg","TR(trailer)4.jpg")
    var presentSlide=0

    function previous( ) { 
      if (document.images && presentSlide > 0) { 
          presentSlide = presentSlide -1 
          document.slideshow.src=slide[presentSlide]
          } 
        } 

    function next( ) { 
      if (document.images && presentSlide < 4) { 
          presentSlide = presentSlide +1 
          document.slideshow.src=slide[presentSlide]
          } 
        } 
      // End Slideshow script -->
    </script>[/code]

    and html:
    [code]<table width="1000" align="center">
      <tr>
        <td>
    <font color="#BF5500" size="4">The Return's Slideshow</font>
    <img src="tropic.jpg" name="slideshow"><p>
    <size="4">
    <a href =  javascript:previous( ) > Previous</A> 
    <a href =  javascript:next( ) > Next</A>
        </td>
      </tr>
    </table>[/code]

    Does for some apperent reason not work, the screenshots are not even displayed even though they are uploaded on the ftp.

    suggestions on this issue would be muxh appreciated, thanks in advance =)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.