Jump to content

Randy

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Posts posted by Randy

  1. I was just wondering if there is a function in php (or an alternative) that is similar to javascript's indexOf, if you don't know what this function does, here is a brief example... [a href=\"http://www.hscripts.com/tutorials/javascript/string-indexof-method.php\" target=\"_blank\"]indexOf[/a]
  2. [code]while($row = mysql_fetch_array( $result )){
        echo '<a href="model.php?m='.$row['model'].'"><br>';
    }[/code]
    model.php
    [code]<?php
        $model = $_GET['m'];
        $result = mysql_query("SELECT * FROM `table` WHERE (`model`='$model')");
        echo("Model: $model");
        echo("<br>Price: " . mysql_result($result, 0, "price"));
    ?>[/code]
    Very simple example...
  3. ok, something was wrong with the post so here is a link to what i was going to post
    [a href=\"http://www.electric-monkey.com/ryan/post.txt\" target=\"_blank\"]http://www.electric-monkey.com/ryan/post.txt[/a]
  4. you need a bit of javascript for that, i remember doing that for a calendar i made, when you selected the month, the days dropdown box was filled. Theres plenty stuff on google that'll help you
  5. try changing MYSQL_NUM to MYSQL_ASSOC

    MYSQL_NUM returns an array like: [0] -> Hello [1] -> Hi
    whereas MYSQL_ASSOC returns an array like: [Money] -> 12 [Tax] -> 17.5

    you can refer to a MYSQL_ASSOC array with $array['tax'] which is what you seem to be using
  6. form.html
    [code]<HTML>
        <head>
            <title>
                Form
            </title>
        </head>
        <body>
            <form action="mail.php" method="POST">
                <input name="name">
                <br><input name="email">
                <br><input name="phone">
                <br><input type="submit" value="Send!">
            </form>
        </body>
    </HTML>[/code]
    mail.php
    [code]<?php
        $email = "your@email.adress";
        $subject = "Contact Form";
        $message = "Name: ".$_POST['name'];
        $message .= "\nEmail Adress: ".$_POST['email'];
        $message .= "\nTelephone: ".$_POST['phone'];
        $message = wordwrap($message, 70);
        mail($email, $subject, $message);
        echo("Thankyou for filling out the Form!");
    ?>[/code]
    I hope this is what you wanted to do...

    the email would look like:

    Name: Bob
    Email Adress: Bob@hotmail.com
    Telephone: 0123 1234567
  7. [!--quoteo(post=377605:date=May 27 2006, 05:21 PM:name=avo)--][div class=\'quotetop\']QUOTE(avo @ May 27 2006, 05:21 PM) [snapback]377605[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    HI

    If this is your server and on the same internet connection you would use something like 192.168.1.101 or localhost (no firewall or routed )(in your house)
    for example

    if your server is running from somewhere else in the world (one you are paying for)you would use there connection address.wwwservername.co.uk

    which one is it ?

    cheers.
    [/quote]

    the www.electric-monkey.com/ type
  8. [code]<HTML>
        <head>
            <title>E-mail sent to your Inbox</title>
        </head>
        <body>
            <?php
                $to = "email removed for privacy reasons";
                $subject = "Mail from your website";
                $from = "FROM: ".$_POST['name']." <".$_POST['email'].">\n";
                $message = wordwrap("This message is from the website.\n\nName: ".$_POST['name']."\nEmail: ".$_POST['email']."\nMessage: ".$_POST['message'], 70);
                mail($to, $subject, $message, $from);
                $to = $_POST['email'];
                $subject = "Thankyou!";
                $from = "FROM: Site Admin <bob@hotmail.com>";
                $message = wordwrap("Thankyou ".$_POST['name'].", blah blah blah", 70);
                mail($to, $subject, $message, $from);
            ?>
            <p>Thank you for contacting us. Please check your Inbox.</p>
        </body>
    </HTML>[/code]

    Try this...
  9. Ok, i made a very simple test...

    [code]<?php
        mysql_connect("localhost","electri_ryan","*********");
        mysql_query("CREATE DATABASE `forums`") or die(mysql_error());
    ?>[/code]

    When i run this i get the error:

    Access denied for user: 'electri_ryan@localhost' to database 'forums'

    Do i have to set privileges or something? 'electri_ryan' has all privileges...
  10. [code]<?php
        // ----------
        $host = "localhost";
        $user = "electri_ryan";
        $pass = "*********";
        // ----------
        mysql_connect($host, $user, $pass) or die("Error Connecting: ".mysql_error());
        $dbs = mysql_list_dbs();
        if(mysql_num_rows($dbs) > 0){
            while(list($db) = mysql_fetch_row($dbs)){
                if($db == "forums"){
                    $exists = true;
                }
            }
        }
        if(!$exists){
            echo("Database does not exist!");
            // Create database...
            mysql_query("CREATE DATABASE `forums`");
        }
    ?>[/code]

    Ok, when i run this code, no errors, and it echoes out "Database does not exist!", but when i look in cPanel, there is not a database calles forums...

    Anybody know what is wrong? [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
  11. ok, i was going to post something but it said "Not Acceptable" so here is the post which i was going to post...

    [a href=\"http://ryan.electric-monkey.com/phpfreakspost.txt\" target=\"_blank\"]http://ryan.electric-monkey.com/phpfreakspost.txt[/a]
  12. i have this code: (for some reason it says error every time i try to post it) [a href=\"http://ryan.electric-monkey.com/phpfreaks.txt\" target=\"_blank\"]http://ryan.electric-monkey.com/phpfreaks.txt[/a]

    but i want to make the days in february dependant upon the year chosen in the 3rd selectbox, not just the current year

    thanks in advance
  13. Why does closing the [code]</form>[/code] tag sometimes make a new line, and sometimes not?
    Also, how do i stop it from creating a new line?

    one day, my website was fine, then the next day, (nothing had been changed/edited) a new line appears
  14. Is it possible to make a submit button just look like a normal link...
    if i was to use
    whatever.php?msg=This is the message and it would probably be too long to use GET
  15. [code]Date = new Date();
    Year = parseFloat(Date.getYear());
    if((round((Year+1900)/4)) == ((Year+1900)/4)){
        leap = 29;
    }else{
        leap = 28;
    }[/code]

    something seems to be wrong, i don't really know what...

    thanks in advance
  16. ok, i would like to make a set of drop-down boxes where people can select the date
    but say, if you selected March, the second dropdown box would automatically have 31 days
    or if you selected April, there would only be 30

    is this possible with php / how would i do it...

    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.