Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Posts posted by HuggieBear

  1. Anything's possible  ;)

    It sounds as though you could stick the if statement in there without much trouble.  Obviously it depends on how you're generating the breadcrumb in the first place, but yeah, should be easy enough.

    Rich
  2. The mail() function within PHP relies on the PHP install knowing where sendmail is on your system at compile time.

    If you use phpinfo() to get information about your install and then look for the values [b]sendmail_from[/b] and [b]sendmail_path[/b] under the 'PHP Core' information.

    If these values are propgated then you're off to a good start.

    Regards
    Rich
  3. Your website_hits_id column is a bad idea, having two pieces of data in one field... Why not just add an additional column, to make the relationships between the tables better?

    That's just my opinion anyway.

    As it is, you'll have to manipulate the data in that column, whether it be in the select statement, or in PHP once you have your recordset.

    Regards
    Rich
  4. Rather that try and stick sql code into a javascript function you're probably better getting the onBlur() event to just submit the form at the early stage and use the php code that it's calling to verify the data/query the database.

    It's likely to be easier that way around.

    Regards
    Rich
  5. If you have PHP with installed, you'l need to make sure you have the "short_open_tag" set to on as I notice you're using [color=red]<?[/color] as an opening tag as opposed to [color=red]<?php[/color].

    Assuming this is all ok then try:

    [code]http://localhost/mysite/images/<? echo "$image_name"; ?>[/code]

    # Note the 'echo'

    Regards
    Rich
  6. Don't forget to check the case.  The link to the font file will be CaSe SeNsitiVe.

    Sometimes this gets overlooked, so your code is looking for times.ttf and the file is called Times.ttf or Times.TTF

    Regards
    Rich
  7. It's possible.

    Echo your SQL statement to the screen before trying to insert it and see how it looks.  Then copy and paste that statement to insert into your DB.  If that doesn't work you know it's as a result of the form.  Possibly some invalid characters in one of the fields.

    Regards
    Rich
  8. I can't understand why you're even using 'on'.  You're converting it for insert into the database anyway, so you may as well just use '[color=red]true[/color]' as the value

    You'd be better off with this surely:

    [code][code=php:0]
    <input type="checkbox" name="test1" value="true" <?php if($test1 == "true"){echo "checked=\"checked\"";}?> />
    [/code][/code]

    And then change your code on the results page to:

    [code]
    $first_name=$_POST['first_name'];
    $last_name=$_POST['last_name'];

    if (isset($_POST['test1']) != "true"){
        $test1 = "null";
    }
    [/code]

    Regards
    Rich
  9. [quote]
    you're missing a variable for 'title'
    [/quote]

    And depending on how your database is setup, you probably aren't allowed to insert 'null' into the ID field.

    This looks as though it's a sql/database error as opposed to PHP.  It's best to try the query in your database first, make sure it works, then code the PHP around it.

    Rich
  10. [quote author=ToonMariner link=topic=105042.msg419336#msg419336 date=1156157482]
    swap echo " CHECKED" for echo " checked=\"checked\"";
    [/quote]

    I can see what genista's done here.  HTML will allow an input type of 'checkbox' to be checked with just CHECKED in the tag, it doesn't require a descriptor of checked="checked" but it certainly would help here.

    Rich
  11. For a start there's no closing tag on the <Input> tag...

    Try this:

    [code]<p>Beautician:</td><td><input type="checkbox" name="beautician" value="<?php if($test1 == "on"){echo" CHECKED";}?>">
    </p>[/code]

    Also although you've only posted a snippet of your code here, it looks as though your HTML tags are nested incorrectly.  The first tag in a paragraph tag should not be a closing table tag as in your example "<p></td>".

    Maybe try this:

    [code]<p>
      Beautician:
      <td>
        <input type="checkbox" name="beautician" value="<?php if($test1 == "on"){echo" CHECKED";}?>">
      </td>
    </p>[/code]

    Regards
    Rich
  12. Is it something like this that you want?

    [url=http://www.dizzie.co.uk/php/test.php]http://www.dizzie.co.uk/php/test.php[/url]

    This page (test.php) check's to see if a form value (in this instance 'name') is set.  If it's set then it calls image.php and displays the result on test.php, if not it displays the form on test.php.

    Here's the code for the two pages, with correct content header types.

    test.php
    [code]
    <?php
    header("Content-Type: text/html");
    if (!isset($_POST['name'])){
    ?>
    <h4>Enter your firstname</h4>
    <form action="test.php" method="post">
    <input type="text" name="name">
    <input type="submit" name="submit" value="Create Image">
    <?php
    }
    else {
    ?>
    <img src="image.php?name=<?php echo $_POST['name'] ?>">
    <br><br><a href="test.php">Try again</a>
    <?php
    }
    ?>
    [/code]

    Here's the code for image.php

    [code]
    <?php
      header("Content-type: image/png");
      $string = $_GET['name'];
      $im = imagecreatefrompng("../logos/pubutton.png");
      $height = imagesy($im);
      $halfheight = $height / 2;
      $width = imagesx($im);
      $halfwidth = $width / 2;
      $fontsize = 48;
      $angle = 0;
      $font = "../logos/smartie.ttf";
      $bg = imagecolorallocate($im, 255,255,255);
      $white = imagecolorallocate($im,255,255,255);
      $black = imagecolorallocate($im,0,0,0);
      $array  = imagettfbbox($fontsize,$angle,$font,$string);
      $textwidth = abs($array[2] - $array[0]);
      $halftextwidth = $textwidth / 2;
      $textheight = abs($array[5] - $array[3]);
      $halftextheight = $textheight / 2;
      $xpos = $halfwidth - $halftextwidth;
      $ypos = $halfheight + $halftextheight;
      imagettftext($im, $fontsize, $angle, $xpos, $ypos, $black, $font, $string);
      imagepng($im);
      imagedestroy($im);
    ?>
    [/code]

    Obviously your image.php file would probably look a lot different from mine.

    Regards
    Rich
×
×
  • 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.