Jump to content

VinceGledhill

Members
  • Posts

    133
  • Joined

  • Last visited

Posts posted by VinceGledhill

  1. Hi people.

     

    I have a form which inputs into a database.

     

    Here is the code that inserts a yes no option...

     <select name = "consent">
            <option value = "Yes" <?php if ($_POST['consent'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['consent'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
            
          
      </select>

     

    However, I have been asked if I can make it a yes or no checkbox instead.

     

    Please can you tell me how I need to code it so that the "yes" or "no" is recorded in the DB.

     

    At the moment I just have this

     

    <input name="consent" type="checkbox" value="Yes" />Yes<br />
        <input name="consent" type="checkbox" value="No" />No<br />
    

     

    Thanks in advance

    VinceG

  2. Hi People.

     

    Please can someone tell me the code to add a time stamp (date and time) to insert into the database at the time of filling out the form.  At the moment my form is putting "null" into this database field.

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Stranded Flyer</title>
    </head>
    
    <body>
    
    <?php
    
    $host = 'localhost';
    $usr = "the_user";
    $password = 'thepassword';
    $db_name = 'thedbname';
    
    //connect to database
    mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
    mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
    
    $surname = mysql_real_escape_string($_POST['surname']);
    $firstname = mysql_real_escape_string($_POST['firstname']);
    $phone1 = mysql_real_escape_string($_POST['phone1']);
    $phone2 = mysql_real_escape_string($_POST['phone2']);
    $location = mysql_real_escape_string($_POST['location']);
    $qualifications = mysql_real_escape_string($_POST['qualifications']); 
    $expertise = mysql_real_escape_string($_POST['expertise']);
    $assistance = mysql_real_escape_string($_POST['assistance']);
    $languages = mysql_real_escape_string($_POST['languages']);
    $e-mail = mysql_real_escape_string($_POST['e-mail']);
    $consent = mysql_real_escape_string($_POST['consent']);
    $published = mysql_real_escape_string($_POST['published']);
    $comments = mysql_real_escape_string($_POST['comments']); 
    $other_info = mysql_real_escape_string($_POST['other_info']);
    
    
    
    $errorstring = ""; // default value of errorstring
    
    function makeSafe($value)
    {
        if (get_magic_quotes_gpc())
        {
            $value = stripslashes($value); 
        }
        
        $value = mysql_real_escape_string($value);
        
        return $value;
    }
    
    if(isset($_POST['submit'])) {
    // Validate all the code inputs
    
    // Captcha Validation
    
    require_once('recaptchalib.php');
    $privatekey = "6Ld2xscSAAAAADwh3mCFkTObSHLAEKUAcU3ocpSv";
    $resp = recaptcha_check_answer ($privatekey,
                                    $_SERVER["REMOTE_ADDR"],
                                    $_POST["recaptcha_challenge_field"],
                                    $_POST["recaptcha_response_field"]);
    
    if (!$resp->is_valid) {
        // What happens when the CAPTCHA was entered incorrectly
        $errorstring = $errorstring. "Invalid CAPTCHA, please try again";
      } else {
    
    if ($surname =="")
    $errorstring = $errorstring. "Surname<br>";
    if ($phone1 =="")
    $errorstring = $errorstring. "phone1<br>";	
    if ($phone2 =="")
    $errorstring = $errorstring. "phone2<br>";
    if ($location =="")
    $errorstring = $errorstring. "location<br>";
    if	($qualifications =="")
    $errorstring = $errorstring. "qualifications<br>";
    if ($assistance =="")
    $errorstring = $errorstring. "assistance<br>";
    if ($languages =="")
    $errorstring = $errorstring. "languages<br>";
    if ($e-mail =="")
    $errorstring = $errorstring. "e-mail<br>";
    if ($consent =="")
    $errorstring = $errorstring. "consent<br>";
    if ($published =="")
    $errorstring = $errorstring. "published<br>";
    if ($comments =="")
    $errorstring = $errorstring. "comments<br>";	
    if ($other_info =="")
    $errorstring = $errorstring. "other info<br>";
    
    // does the errorstring = "nothing"?
    
    }
    // Figure out which error message to show i.e. field validation or CAPTCHA
    if ($errorstring !="")
       if (strstr($errorstring,"CAPTCHA")) echo $errorstring;
      else echo "You have not put anything in the following fields: <br><br> $errorstring";
    //echo "If you have nothing to put in the box please type the word \"None\" or \"N\/A\"";
    //die ("Please try again, ensuring that you fill out all the fields!");
    else 
    {
    
    
    //echo "Your data has been saved";
    
    
    $insert_query = "INSERT INTO HelperFormData (surname, firstname,phone1, phone2, location, qualifications, expertise, assistance, languages, e-mail, consent, published, comments, other_info,) VALUES ('$surname', '$firstname', '$phone1','$phone2', '$location', '$qualifications', '$expertise', '$assistance', '$languages', '$e-mail', '$consent', '$published', '$comments', '$other_info')";
    $insert_action = mysql_query($insert_query) or die ('Error During Insert :<br>'.mysql_error().'<br><br>Error occured running the following code :<br>'.$insert_query);
    
    $id = mysql_insert_id();
    
    echo "Thank you, Your details have been submitted.";
    //include "resultcard.php";
    
    // Output what the form looks like
    
    // End of how the form looks 
    
    }
    }
    
    if(!isset($_POST['submit']) || (isset($_POST['submit']) && !empty($errorstring)))
    {
    ?>
    
    <form name = "form1" method ="post" action="">
    <table width="700" border="0" cellspacing="5" cellpadding="5" bgcolor = "#dddddd">
      <caption>
        Submit Your  Details
      </caption>
      <tr>
        <td width = "50"> </td>
        <td width = "240"> </td>
        <td width = "250"> </td>
        <td width = "160"><b>Example Input</b></td>
      </tr>
      
      <tr>
        <td> </td>
        <td>Surname</td>
        <td><input type='text' name='surname' size = '40' maxlength='30' value = '<?php echo $surname; ?>'></td>
        <td>Smith</td>
      </tr>
      
      <tr>
        <td> </td>
        <td>First Name</td>
        <td><input type='text' name='firstname' size = '40' maxlength='30' value = '<?php echo $firstname; ?>'></td>
        <td>Bill</td>
      </tr>
      
      <tr>
        <td> </td>
        <td>Phone 1</td>
        <td><input type='text' name='phone1' size = '40' maxlength='30' value = '<?php echo $phone1; ?>'></td>
        <td>07777 777777</td>
      </tr>
      
      
      
      <tr>
        <td> </td>
        <td>Phone 2</td>
        <td><input type='text' name='phone2' size = '40' maxlength= '30'value = '<?php echo $phone2; ?>'></td>
        <td>0118 123 4567</td>
      </tr>
      <tr>
        <td> </td>
        <td>Location</td>
        <td><input type='text' name='location' size = '40' maxlength='40'value = '<?php echo $location; ?>'></td>
        <td>52.289071,-1.952004</td>
      </tr>
      <tr>
        <td> </td>
        <td>Qualifications</td>
        <td><input type='text' name='qualifications'  size = '40' maxlength='30' value = '<?php echo $qualifications; ?>'></td>
        <td>Electrician</td>
      </tr>
      <tr>
        <td> </td>
        <td>Expertise</td>
        <td><input type='text' name='qualifications'  size = '40' maxlength='30' value = '<?php echo $expertise; ?>'></td>
        <td>Flexwings</td>
      </tr>
      <tr>
        <td> </td>
        <td>Assistance Offered</td>
        <td><input type='text' name='assistance' size = '40' maxlength='50' value = '<?php echo $assistance; ?>' /></td>
        <td>Trailer and Tow Car</td>
      </tr>
      <tr>
        <td> </td>
        <td>Language Skills</td>
        <td><input type='text' name='published' size = '40' maxlength='50' value = '<?php echo $language; ?>' /></td>
        <td><p>English / Spanish</p></td>
      </tr>
      <tr>
        <td> </td>
        <td>E-Mail</td>
        <td><input type='text' name='comments' size = '40' maxlength='50' value = '<?php echo $e-mail; ?>' /></td>
        <td><p>example@mail.net</p></td>
      </tr>
      <tr>
        <td> </td>
        <td>Consent</td>
        <td>
          <select name = "surface">
            <option value = "Yes" <?php if ($_POST['consent'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['consent'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
            
          
      </select>
          
          </td>
        <td>Yes</td>
      </tr>
      <tr>
        <td> </td>
        <td>Published</td>
        <td>
        
         <select name = "food">
         <option value = "Yes" <?php if ($_POST['published'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['published'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
    </select>
        
        </td>
        <td>Yes</td>
      </tr>
      <tr>
        <td> </td>
        <td>Comments</td>
        <td><textarea name= "remarks" input type = 'text' rows = "5" cols = "29" /><?php echo $remarks; ?></textarea></td>
        <td>As much info as possible 500 characters max</td>
      </tr>
      <tr>
        <td> </td>
        <td>Other Info</td>
        <td><textarea name= "warnings" input="input" type = 'text' rows = "5" cols = "29" /><?php echo $warnings; ?></textarea></td>
        <td>As much info as possible 500 characters max</td>
      </tr>
      <tr>
        <td> </td>
        <td><input type='submit' name='submit' value='Submit Your Info' /></td>
        <td colspan="2">
          <? require_once('recaptchalib.php');
      $publickey = "6Ld2xscSAAAAAH3_KiJoRLR4sEWFFQR4yAr5F1xi"; // you got this from the signup page
      echo recaptcha_get_html($publickey);?></td>
      </tr>
    </table>
    </form>
    
    
    </body>
    </html>
    <?php } ?>

  3. Hi People.

     

    Thanks for all the help with my ongoing project.

     

    Please can you tell me what my problem is with this error?

     

    Error During Insert :

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('test', 'tesast', 'tesat','tear', 'sest', 'none whatsoever', '', 'ter'' at line 1

     

    Error occured running the following code :

    INSERT INTO HelperFormData (surname, firstname, phone1, phone2, location, qualifications, expertise, assistance, languages, e_mail, consent, published, comments, other_info,) VALUES ('test', 'tesast', 'tesat','tear', 'sest', 'none whatsoever', '', 'ter', 'my language', 'vince@vince.com', 'No', 'No', 'ateaglea', 'ttaelgae')

     

    Here is the code to my insert form

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Stranded Flyer</title>
    </head>
    
    <body>
    
    <?php
    
    $host = 'localhost';
    $usr = "username";
    $password = 'password';
    $db_name = 'stranded';
    
    //connect to database
    mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
    mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
    
    $surname = mysql_real_escape_string($_POST['surname']);
    $firstname = mysql_real_escape_string($_POST['firstname']);
    $phone1 = mysql_real_escape_string($_POST['phone1']);
    $phone2 = mysql_real_escape_string($_POST['phone2']);
    $location = mysql_real_escape_string($_POST['location']);
    $qualifications = mysql_real_escape_string($_POST['qualifications']); 
    $expertise = mysql_real_escape_string($_POST['expertise']);
    $assistance = mysql_real_escape_string($_POST['assistance']);
    $languages = mysql_real_escape_string($_POST['languages']);
    $e_mail = mysql_real_escape_string($_POST['e_mail']);
    $consent = mysql_real_escape_string($_POST['consent']);
    $published = mysql_real_escape_string($_POST['published']);
    $comments = mysql_real_escape_string($_POST['comments']); 
    $other_info = mysql_real_escape_string($_POST['other_info']);
    
    
    
    $errorstring = ""; // default value of errorstring
    
    function makeSafe($value)
    {
        if (get_magic_quotes_gpc())
        {
            $value = stripslashes($value); 
        }
        
        $value = mysql_real_escape_string($value);
        
        return $value;
    }
    
    if(isset($_POST['submit'])) {
    // Validate all the code inputs
    
    // Captcha Validation
    
    
    require_once('recaptchalib.php');
    $privatekey = "MyPrivateKeyRemovedForTheForumPost";
    $resp = recaptcha_check_answer ($privatekey,
                                    $_SERVER["REMOTE_ADDR"],
                                 $_POST["recaptcha_challenge_field"],
                                    $_POST["recaptcha_response_field"]);
    
    if (!$resp->is_valid) {
        // What happens when the CAPTCHA was entered incorrectly
       $errorstring = $errorstring. "Invalid CAPTCHA, please try again";
      } else {
    
    if ($surname =="")
    $errorstring = $errorstring. "Surname<br>";
    if ($phone1 =="")
    $errorstring = $errorstring. "phone1<br>";	
    if ($phone2 =="")
    $errorstring = $errorstring. "phone2<br>";
    if ($location =="")
    $errorstring = $errorstring. "location<br>";
    if	($qualifications =="")
    $errorstring = $errorstring. "qualifications<br>";
    if ($assistance =="")
    $errorstring = $errorstring. "assistance<br>";
    if ($languages =="")
    $errorstring = $errorstring. "languages<br>";
    if ($e_mail =="")
    $errorstring = $errorstring. "e_mail<br>";
    if ($consent =="")
    $errorstring = $errorstring. "consent<br>";
    if ($published =="")
    $errorstring = $errorstring. "published<br>";
    if ($comments =="")
    $errorstring = $errorstring. "comments<br>";	
    if ($other_info =="")
    $errorstring = $errorstring. "other info<br>";
    
    // does the errorstring = "nothing"?
    
    }
    // Figure out which error message to show i.e. field validation or CAPTCHA
    if ($errorstring !="")
       if (strstr($errorstring,"CAPTCHA")) echo $errorstring;
      else echo "You have not put anything in the following fields: <br><br> $errorstring";
    //echo "If you have nothing to put in the box please type the word \"None\" or \"N\/A\"";
    //die ("Please try again, ensuring that you fill out all the fields!");
    else 
    {
    
    
    //echo "Your data has been saved";
    
    
    $insert_query = "INSERT INTO HelperFormData (surname, firstname, phone1, phone2, location, qualifications, expertise, assistance, languages, e_mail, consent, published, comments, other_info,) VALUES ('$surname', '$firstname', '$phone1','$phone2', '$location', '$qualifications', '$expertise', '$assistance', '$languages', '$e_mail', '$consent', '$published', '$comments', '$other_info')";
    $insert_action = mysql_query($insert_query) or die ('Error During Insert :<br>'.mysql_error().'<br><br>Error occured running the following code :<br>'.$insert_query);
    
    $id = mysql_insert_id();
    
    echo "Thank you, Your details have been submitted.";
    //include "resultcard.php";
    
    // Output what the form looks like
    
    // End of how the form looks 
    
    }
    }
    
    if(!isset($_POST['submit']) || (isset($_POST['submit']) && !empty($errorstring)))
    {
    ?>
    
    <form name = "form1" method ="post" action="">
    <table width="700" border="0" cellspacing="5" cellpadding="5" bgcolor = "#dddddd">
      <caption>
        Submit Your  Details
      </caption>
      <tr>
        <td width = "50"> </td>
        <td width = "240"> </td>
        <td width = "250"> </td>
        <td width = "160"><b>Example Input</b></td>
      </tr>
      
      <tr>
        <td> </td>
        <td>Surname</td>
        <td><input type='text' name='surname' size = '40' maxlength='30' value = '<?php echo $surname; ?>'></td>
        <td>Smith</td>
      </tr>
      
      <tr>
        <td> </td>
        <td>First Name</td>
        <td><input type='text' name='firstname' size = '40' maxlength='30' value = '<?php echo $firstname; ?>'></td>
        <td>Bill</td>
      </tr>
      
      <tr>
        <td> </td>
        <td>Phone 1</td>
        <td><input type='text' name='phone1' size = '40' maxlength='30' value = '<?php echo $phone1; ?>'></td>
        <td>07777 777777</td>
      </tr>
      
      
      
      <tr>
        <td> </td>
        <td>Phone 2</td>
        <td><input type='text' name='phone2' size = '40' maxlength= '30'value = '<?php echo $phone2; ?>'></td>
        <td>0118 123 4567</td>
      </tr>
      <tr>
        <td> </td>
        <td>Location</td>
        <td><input type='text' name='location' size = '40' maxlength='40'value = '<?php echo $location; ?>'></td>
        <td>52.289071,-1.952004</td>
      </tr>
      <tr>
        <td> </td>
        <td>Qualifications</td>
        <td><input type='text' name='qualifications'  size = '40' maxlength='30' value = '<?php echo $qualifications; ?>'></td>
        <td>Electrician</td>
      </tr>
      <tr>
        <td> </td>
        <td>Expertise</td>
        <td><input type='text' name='qualifications'  size = '40' maxlength='30' value = '<?php echo $expertise; ?>'></td>
        <td>Flexwings</td>
      </tr>
      <tr>
        <td> </td>
        <td>Assistance Offered</td>
        <td><input type='text' name='assistance' size = '40' maxlength='50' value = '<?php echo $assistance; ?>' /></td>
        <td>Trailer and Tow Car</td>
      </tr>
      <tr>
        <td> </td>
        <td>Language Skills</td>
        <td><input type='text' name='languages' size = '40' maxlength='50' value = '<?php echo $languages; ?>' /></td>
        <td><p>English / Spanish</p></td>
      </tr>
      <tr>
        <td> </td>
        <td>e_mail</td>
        <td><input type='text' name='e_mail' size = '40' maxlength='50' value = '<?php echo $e_mail; ?>' /></td>
        <td><p>example@mail.net</p></td>
      </tr>
      <tr>
        <td> </td>
        <td>Consent</td>
        <td>
          <select name = "consent">
            <option value = "Yes" <?php if ($_POST['consent'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['consent'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
            
          
      </select>
          
          </td>
        <td>Yes</td>
      </tr>
      <tr>
        <td> </td>
        <td>Published</td>
        <td>
        
         <select name = "published">
         <option value = "Yes" <?php if ($_POST['published'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['published'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
    </select>
        
        </td>
        <td>Yes</td>
      </tr>
      <tr>
        <td> </td>
        <td>Comments</td>
        <td><textarea name= "comments" input type = 'text' rows = "5" cols = "29" /><?php echo $comments; ?></textarea></td>
        <td>As much info as possible 500 characters max</td>
      </tr>
      <tr>
        <td> </td>
        <td>Other Info</td>
        <td><textarea name= "other_info" input="input" type = 'text' rows = "5" cols = "29" /><?php echo $other_info; ?></textarea></td>
        <td>As much info as possible 500 characters max</td>
      </tr>
      <tr>
        <td> </td>
        <td><input type='submit' name='submit' value='Submit Your Info' /></td>
        <td colspan="2">
          <? require_once('recaptchalib.php');
      $publickey = "MyPublicKeyRemovedFromTheForumPost"; // you got this from the signup page
      echo recaptcha_get_html($publickey);
      ?></td>
      </tr>
    </table>
    </form>
    
    
    </body>
    </html>
    <?php } ?>

  4. Hi People.

     

    Does anyone have any idea why this form is showing as a blank page on my site?  Can you see what I've missed?

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Stranded Flyer</title>
    </head>
    
    <body>
    
    <?php
    
    $host = 'localhost';
    $usr = "the_user";
    $password = 'thepassword';
    $db_name = 'thedbname';
    
    //connect to database
    mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
    mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
    
    $surname = mysql_real_escape_string($_POST['surname']);
    $firstname = mysql_real_escape_string($_POST['firstname']);
    $phone1 = mysql_real_escape_string($_POST['phone1']);
    $phone2 = mysql_real_escape_string($_POST['phone2']);
    $location = mysql_real_escape_string($_POST['location']);
    $qualifications = mysql_real_escape_string($_POST['qualifications']); 
    $expertise = mysql_real_escape_string($_POST['expertise']);
    $assistance = mysql_real_escape_string($_POST['assistance']);
    $languages = mysql_real_escape_string($_POST['languages']);
    $e-mail = mysql_real_escape_string($_POST['e-mail']);
    $consent = mysql_real_escape_string($_POST['consent']);
    $published = mysql_real_escape_string($_POST['published']);
    $comments = mysql_real_escape_string($_POST['comments']); 
    $other_info = mysql_real_escape_string($_POST['other_info']);
    
    
    
    $errorstring = ""; // default value of errorstring
    
    function makeSafe($value)
    {
        if (get_magic_quotes_gpc())
        {
            $value = stripslashes($value); 
        }
        
        $value = mysql_real_escape_string($value);
        
        return $value;
    }
    
    if(isset($_POST['submit'])) {
    // Validate all the code inputs
    
    // Captcha Validation
    
    require_once('recaptchalib.php');
    $privatekey = "6Ld2xscSAAAAADwh3mCFkTObSHLAEKUAcU3ocpSv";
    $resp = recaptcha_check_answer ($privatekey,
                                    $_SERVER["REMOTE_ADDR"],
                                    $_POST["recaptcha_challenge_field"],
                                    $_POST["recaptcha_response_field"]);
    
    if (!$resp->is_valid) {
        // What happens when the CAPTCHA was entered incorrectly
        $errorstring = $errorstring. "Invalid CAPTCHA, please try again";
      } else {
    
    if ($surname =="")
    $errorstring = $errorstring. "Surname<br>";
    if ($phone1 =="")
    $errorstring = $errorstring. "phone1<br>";	
    if ($phone2 =="")
    $errorstring = $errorstring. "phone2<br>";
    if ($location =="")
    $errorstring = $errorstring. "location<br>";
    if	($qualifications =="")
    $errorstring = $errorstring. "qualifications<br>";
    if ($assistance =="")
    $errorstring = $errorstring. "assistance<br>";
    if ($languages =="")
    $errorstring = $errorstring. "languages<br>";
    if ($e-mail =="")
    $errorstring = $errorstring. "e-mail<br>";
    if ($consent =="")
    $errorstring = $errorstring. "consent<br>";
    if ($published =="")
    $errorstring = $errorstring. "published<br>";
    if ($comments =="")
    $errorstring = $errorstring. "comments<br>";	
    if ($other_info =="")
    $errorstring = $errorstring. "other info<br>";
    
    // does the errorstring = "nothing"?
    
    }
    // Figure out which error message to show i.e. field validation or CAPTCHA
    if ($errorstring !="")
       if (strstr($errorstring,"CAPTCHA")) echo $errorstring;
      else echo "You have not put anything in the following fields: <br><br> $errorstring";
    //echo "If you have nothing to put in the box please type the word \"None\" or \"N\/A\"";
    //die ("Please try again, ensuring that you fill out all the fields!");
    else 
    {
    
    
    //echo "Your data has been saved";
    
    
    $insert_query = "INSERT INTO HelperFormData (surname, firstname,phone1, phone2, location, qualifications, expertise, assistance, languages, e-mail, consent, published, comments, other_info,) VALUES ('$surname', '$firstname', '$phone1','$phone2', '$location', '$qualifications', '$expertise', '$assistance', '$languages', '$e-mail', '$consent', '$published', '$comments', '$other_info')";
    $insert_action = mysql_query($insert_query) or die ('Error During Insert :<br>'.mysql_error().'<br><br>Error occured running the following code :<br>'.$insert_query);
    
    $id = mysql_insert_id();
    
    echo "Thank you, Your details have been submitted.";
    //include "resultcard.php";
    
    // Output what the form looks like
    
    // End of how the form looks 
    
    }
    }
    
    if(!isset($_POST['submit']) || (isset($_POST['submit']) && !empty($errorstring)))
    {
    ?>
    
    <form name = "form1" method ="post" action="">
    <table width="700" border="0" cellspacing="5" cellpadding="5" bgcolor = "#dddddd">
      <caption>
        Submit Your  Details
      </caption>
      <tr>
        <td width = "50"> </td>
        <td width = "240"> </td>
        <td width = "250"> </td>
        <td width = "160"><b>Example Input</b></td>
      </tr>
      
      <tr>
        <td> </td>
        <td>Surname</td>
        <td><input type='text' name='surname' size = '40' maxlength='30' value = '<?php echo $surname; ?>'></td>
        <td>Smith</td>
      </tr>
      
      <tr>
        <td> </td>
        <td>First Name</td>
        <td><input type='text' name='firstname' size = '40' maxlength='30' value = '<?php echo $firstname; ?>'></td>
        <td>Bill</td>
      </tr>
      
      <tr>
        <td> </td>
        <td>Phone 1</td>
        <td><input type='text' name='phone1' size = '40' maxlength='30' value = '<?php echo $phone1; ?>'></td>
        <td>07777 777777</td>
      </tr>
      
      
      
      <tr>
        <td> </td>
        <td>Phone 2</td>
        <td><input type='text' name='phone2' size = '40' maxlength= '30'value = '<?php echo $phone2; ?>'></td>
        <td>0118 123 4567</td>
      </tr>
      <tr>
        <td> </td>
        <td>Location</td>
        <td><input type='text' name='location' size = '40' maxlength='40'value = '<?php echo $location; ?>'></td>
        <td>52.289071,-1.952004</td>
      </tr>
      <tr>
        <td> </td>
        <td>Qualifications</td>
        <td><input type='text' name='qualifications'  size = '40' maxlength='30' value = '<?php echo $qualifications; ?>'></td>
        <td>Electrician</td>
      </tr>
      <tr>
        <td> </td>
        <td>Expertise</td>
        <td><input type='text' name='qualifications'  size = '40' maxlength='30' value = '<?php echo $expertise; ?>'></td>
        <td>Flexwings</td>
      </tr>
      <tr>
        <td> </td>
        <td>Assistance Offered</td>
        <td><input type='text' name='assistance' size = '40' maxlength='50' value = '<?php echo $assistance; ?>' /></td>
        <td>Trailer and Tow Car</td>
      </tr>
      <tr>
        <td> </td>
        <td>Language Skills</td>
        <td><input type='text' name='published' size = '40' maxlength='50' value = '<?php echo $language; ?>' /></td>
        <td><p>English / Spanish</p></td>
      </tr>
      <tr>
        <td> </td>
        <td>E-Mail</td>
        <td><input type='text' name='comments' size = '40' maxlength='50' value = '<?php echo $e-mail; ?>' /></td>
        <td><p>example@mail.net</p></td>
      </tr>
      <tr>
        <td> </td>
        <td>Consent</td>
        <td>
          <select name = "surface">
            <option value = "Yes" <?php if ($_POST['consent'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['consent'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
            
          
      </select>
          
          </td>
        <td>Yes</td>
      </tr>
      <tr>
        <td> </td>
        <td>Published</td>
        <td>
        
         <select name = "food">
         <option value = "Yes" <?php if ($_POST['published'] == 'Yes') { echo 'selected="selected"'; } ?>>Yes</option>
            <option value = "No" <?php if ($_POST['published'] == 'No') { echo 'selected="selected"'; } ?>>No</option>
    </select>
        
        </td>
        <td>Yes</td>
      </tr>
      <tr>
        <td> </td>
        <td>Comments</td>
        <td><textarea name= "remarks" input type = 'text' rows = "5" cols = "29" /><?php echo $remarks; ?></textarea></td>
        <td>As much info as possible 500 characters max</td>
      </tr>
      <tr>
        <td> </td>
        <td>Other Info</td>
        <td><textarea name= "warnings" input="input" type = 'text' rows = "5" cols = "29" /><?php echo $warnings; ?></textarea></td>
        <td>As much info as possible 500 characters max</td>
      </tr>
      <tr>
        <td> </td>
        <td><input type='submit' name='submit' value='Submit Your Info' /></td>
        <td colspan="2">
          <? require_once('recaptchalib.php');
      $publickey = "6Ld2xscSAAAAAH3_KiJoRLR4sEWFFQR4yAr5F1xi"; // you got this from the signup page
      echo recaptcha_get_html($publickey);?></td>
      </tr>
    </table>
    </form>
    
    
    </body>
    </html>
    <?php } ?>

  5. Hello People.

     

    I would like to build a small calculator in php for my website.

     

    Basically what it does is give a form to the user that looks like this

    warranty_workings.jpg

     

    The formula is as follows.

    number_from_box1

    *

    number_from_box2

     

    =result1

     

    then take result1

    *52

     

    =result2

     

    now take 60,000

    /result2

     

    =result3

     

    Take result3 and make it a number with only 2 decimal places

    =result4

     

    Then display the result on the form like this

     

    Your warranty would be "result4" years

     

    I know that there are some really good coders on here.  Please could one of you talented people tell me what is the php to do the above on my site?

  6. Hi people.

     

    I'm very new to PHP and am building the www.airfieldcards.com website for pilots to use free of charge.

     

    I have made a subdomain "m" which I am going to use for the "mobile version" of the site.

     

    I have made the "information" showing card but need to make a menu as the first thing that the user sees when he logs onto the site via a mobile device (iPhone / android etc)

     

    It needs to take "username" from the database (this is the airfield name)

    Then list them in order (alphabetically)

    Then make a link out of the word to the ?"id" from the DB and display the relevant card.

     

    In other words.  When the user visits http://m.airfieldcards.com the are greeted with the following

     

    Abbots Bromley

    Alderney

    Andrewsfield

     

    Here is the php that shows the actual "phone" version of the card.

     

    <?php
    $host = 'localhost';
    
    $usr = "username";
    
    $password = 'thepassword';
    
    $db_name = 'TheNameOfTheDB';
    
    function cr($string){
              $clean_string = str_replace("rn","<BR>",$string);
             return $clean_string;
    }
    
    if (!isset($id)) $id = $_GET['id'];
    
    mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
    mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
    
    $read_query  = "select * from users where user_id = '$id'";
    $results = mysql_query($read_query);
    
    $rs = mysql_fetch_array($results);
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    
    <style type="text/css">
    <!--
    body table {
    }
    body,td,th {
    font-size: x-large;
    }
    
    -->
    </style>
    <body>
    Airfield Name: <? echo $rs["username"]; ?>
    
    <table width="480" border="1" cellspacing="0" cellpadding="2">
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Height Above</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["height_above"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Mb Difference</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["mb_diff"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Alternative</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["alternative"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td  bgcolor = #dbeff8><span class="xx_large_font">General Location</span></td>
        <td  bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["general_location"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Grid Reference</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["location_grid"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Runway Num</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["runway_numbers"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td width="240" bgcolor = #E6F8EB><span class="xx_large_font">Circuit Dir</span></td>
        <td width="240" bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["circuit_direction"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Cirtuit Height</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["circuit_height"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Runway m</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["runway_length"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">OHJ Height</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["ohj_height"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Surface</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["surface"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Radio Freq</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["radio_frequency"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Callsign</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["radio_callsign"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Type</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["radio_type"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Other Radio</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["other_radio"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Fuel</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["fuel"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Landing Fee</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["landing_fee"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Opp Hrs</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["operating_hours"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Maintenance</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["maintenance"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Hangarage</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["hangarage"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Parking</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["parking"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #dbeff8><span class="xx_large_font">Food</span></td>
        <td bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["food"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">School</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["school"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td colspan="2"><span class="xx_large_font">Remarks:<? echo $rs["remarks"]; ?></span></td>
      </tr>
      <tr>
        <td colspan="2"><span class="xx_large_font">Warnings:<? echo $rs["warnings"]; ?></span></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><span class="xx_large_font">Website</span></td>
        <td bgcolor = #E6F8EB><div align="right"><span class="xx_large_font"><strong><? echo $rs["weblinks"]; ?></strong></span></div></td>
      </tr>
      <tr>
        <td width="240" bgcolor = #dbeff8><span class="xx_large_font">Operator</span></td>
        <td width="240" bgcolor = #dbeff8><div align="right"><span class="xx_large_font"><strong><? echo $rs["operator"]; ?></strong></span></div></td>
      </tr>
    </table>
    
    <p class="xx_large_font"> </p>
    <p> </p>
    </body>
    </html>
    </html>

     

    Any help would be really appreciated.  Thanks in advance.

  7. Hi People. 

     

    Thanks for all the help on here in the past, you have been brilliant.

     

    I run the airfield cards.com website and have a script in the output page that is as follows.

    To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe  src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>">

     

    Now the way it shows on the site is like this

    <iframe  src='http://www.airfieldcards.com/php/courtesy_card.php?id=165' ></iframe>

     

    So, I look at the iframe code from google that should be cut and pasted into a website (obviously it's working code from google)

    <iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&output=embed"></iframe><br /><small>View <a href="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&source=embed" style="color:#0000FF;text-align:left">AirfieldCards.com</a> in a larger map</small>

     

    Now I have tried to take the code from the google iframe (width/height/scrolling/etc) and paste it into my source but it doesn't work.

     

    Here's how I have done it.

    To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe  width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>">

     

    Can someone please modify my fist lot of code so that I have the correct height and width settings (700 x 1500)

     

    Thanks in advance

     

    Regards

    Vince Gledhill

     

     

     

     

  8. Hello people.

     

    I run the site http://www.airfieldcards.com and if you take a look at it you will see that it is totally free from profit. 

     

    Now I would like people to be able to add comments at the bottom of each card. 

     

    The card is displayed in an iframe as a PHP script within a joomla site. 

     

    Is there anyone out there willing to help me for free?  I know I'm asking a lot but I am so busy adding the individual airfield information to build up the database that I haven't really got the time to learn the necessary skills to add this functionality.

     

    You can obviously use it as a reference for other jobs you may want to do in the future.

     

    Regards

    Vince Gledhill

  9. looking at that you should be able to just call an object that points to that php page:

     

    <object 
    type="text/html" 
    data="http://domain/page.php?id=xxx
    width="xxx"
    height="xxx"
    >
    <param name="flight_card" value="http://domain/page.php?id=xx>
    alt text
    </object>[code]

     

    Thanks for that Muddy_Funster.

     

    How do I dynamically load the value="http://domain/page.php?id=xx> from the card that the user is looking at?

     

    I want to be able to put a link in the card that states [click this link to get the code to add this card to your site] or similar.

  10. Here is the results card, obviously I've changed all of the $usr $password $db_name for posting on here.

    <?php
    $host = 'localhost';
    
    $usr = "theuser_name";
    
    $password = 'thepassword';
    
    $db_name = 'database_name';
    
    function cr($string){
              $clean_string = str_replace("rn","<BR>",$string);
             return $clean_string;
    }
    
    //$id = 11;
    // Here's hoping that this works at the right width.  Don't know why it is showing the 
    // printable card menu at the right width but not the height above etc
    
    if (!isset($id)) $id = $_GET['id'];
    
    mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
    mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
    
    $read_query  = "select * from users where user_id = '$id'";
    $results = mysql_query($read_query);
    
    $rs = mysql_fetch_array($results);
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body,td,th {
    font-size: 13px;
    }
    .align_text_to_centre_of_cells {
    text-align: center;
    }
    -->
    </style></head>
    
    <body>
    
    <p><strong><? echo $rs["username"]; ?></strong></p>
    <table width="702" border="1" bordercolor = "#2c2cf6" textcolor = "#2c2cf6"cellspacing="1" cellpadding="5">
      <tr>
        <td>Printable Card</td>
        <td><a href="http://microlight.co/vince_php/printcard.php?id=<?php echo $id ?>" target="_blank">Basic Info</a></td>
        <td><a href="http://microlight.co/vince_php/printcard02.php?id=<?php echo $id ?>" target="_blank">Full Info</a></td>
        <td><a href="http://microlight.co/vince_php/printcard03.php?id=<?php echo $id ?>" target="_blank">Image</a></td>
        <td><a href="http://microlight.co/vince_php/printcard04.php?id=<?php echo $id ?>" target="_blank">Bat Mitzvah</a></td>
      </tr>
    </table>
     
    <table width="702" border="1" bordercolor = "#2c2cf6" textcolor = "#2c2cf6"cellspacing="1" cellpadding="4">
      <tr>
        <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Height Above MSL</span></td>
        <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Mb Difference</span></td>
        <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Alternative</span></td>
        <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">PPR?</span></td>
        <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Location General</span></td>
        <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Location Grid Ref:</span></td>
      </tr>
      <tr>
        <td bgcolor = #eff5fc textcolor = #AC1636><span class="align_text_to_centre_of_cells"><strong><? echo $rs["height_above"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["mb_diff"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["alternative"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["ppr"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["general_location"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["location_grid"]; ?></strong></span></td>
      </tr>
      <tr>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Runway Numbers</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Circuit Direction</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Circuit Height</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Runway Length</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Overhead Join?</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Runway Surface</span></td>
      </tr>
      <tr>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["runway_numbers"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["circuit_direction"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["circuit_height"]; ?><br />
        </strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["runway_length"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["ohj_height"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["surface"]; ?></strong></span></td>
      </tr>
      <tr>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Radio Frequency</span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Radio Callsign</span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Radio Type</span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Other Radio</span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Fuel?</span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Landing Fee £</span></td>
      </tr>
      <tr>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["radio_frequency"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["radio_callsign"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["radio_type"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["other_radio"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["fuel"]; ?></strong></span></td>
        <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["landing_fee"]; ?></strong></span></td>
      </tr>
      <tr>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Opperating Hrs</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Maintenance</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Hangarage</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Parking</span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Food? </span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">School ?</span></td>
      </tr>
      <tr>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["operating_hours"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["maintenance"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["hangarage"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["parking"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["food"]; ?></strong></span></td>
        <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["school"]; ?></strong></span></td>
      </tr>
      <tr>
        <td colspan="6"><p>Remarks<p><strong><? echo $rs["remarks"]; ?></strong></td>
      </tr>
      <tr>
        <td colspan="6"><p>Warnings:</p>
        <p><strong><? echo $rs["warnings"]; ?></strong></p>
        <p> </p></td>
      </tr>
      <tr>
        <td colspan="3"><p>Website: </p>
        <p><strong><? echo $rs["weblinks"]; ?></strong></p></td>
        <td colspan="3"><p>Operator:</p>
        <p><strong><? echo $rs["operator"]; ?></strong></p></td>
      </tr>
      <tr>
        <td colspan="6">Google Ifram Image<br /><strong><? echo $rs["google_image"]; ?></strong></td>
      </tr>
    </table>
    
    
    </body>
    </html>
    </html>

     

  11. Hi People.

     

    I am doing quite well with my www.airfieldcards.com website which is information for pilots in the UK and ireland should they wish to visit another airfield.

     

    It is in the form of a flight guide for free.

     

    Each card is held in a database and the cards are shown on the site by loading the following script

    /php/results.php?id=132

     

    In the above example the card for c-moor in Ireland would be loaded.

     

    I want to be able to add a link within the cards that will give the user "the code" to enter that card within their own website.

     

    Sort of a "click here to get the code to add to your website"

     

    Then opening a separate box in a new window that had something like this in it.

     

    Copy and Paste the following code into your website

    <iframe width="720" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://airfieldcards.com/php/results.php[b][i]"what goes here?"[/i][/b]

     

    What would I put into the bit "what goes here?" to dynamically load that specific card? and give the user the correct code to add into their own site?

     

    Thanks in advance, you guys on here have always been brilliant.

  12. Hi People.

     

    I run the following airfield site http://www.microlight.co

     

    Now on each airfield card there is a google iframe image that is held in the database and shows OK on the page.

     

    Anyone got any idea how I can get a hold of the co-ordinate information for each card so that I can display it somewhere else on screen?

     

    Here is a typical image of the airfield I use.

     

    <iframe width="700" height="700" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.co.uk/maps?ie=UTF8&t=h&ll=53.952058,-1.17631&spn=0.008839,0.014999&z=16&output=embed"></iframe><br /><small><a href="http://www.google.co.uk/maps?ie=UTF8&t=h&ll=53.952058,-1.17631&spn=0.008839,0.014999&z=16&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>

  13. Hi people.

     

    I am trying to make a dynamic link in my output form.  The link goes something like this

    - <a href="http://microlight.co/vince_php/printcard.php?id=96">Printable Card</a>

     

    However, I would like the $id of the record from the actual page that I am loading. In other words, I would like the Printable Card to be the same "$id" as the card that it is linked from.

     

    Please can someone tell me how to code the above line?

     

    I've tried it like this and many other combinations thereof but can't seem to crack it.

     

    - <a href="http://microlight.co/vince_php/printcard.php?id=<?"$id"?>">Printable Card</a>

     

    Here is my whole output card

    <?php
    $host = 'localhost';
    
    $usr = "username";
    
    $password = 'thepassword';
    
    $db_name = 'sitename';
    
    function cr($string){
              $clean_string = str_replace("\r\n","<BR>",$string);
             return $clean_string;
    }
    
    if (!isset($id)) $id = $_GET['id'];
    
    mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
    mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
    
    $read_query  = "select * from users where user_id = '$id'";
    $results = mysql_query($read_query);
    
    $rs = mysql_fetch_array($results);
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    
    Airfield Name: <? echo $rs["username"]; ?>
    
    <table width="720" border="1" bordercolor = "#2c2cf6" textcolor = "#2c2cf6"cellspacing="1" cellpadding="5">
      <tr>
        <td width="120" bgcolor = #E6F8EB>Height Above MSL</td>
        <td width="120" bgcolor = #E6F8EB>Mb Difference</td>
        <td width="120" bgcolor = #E6F8EB>Alternative</td>
        <td width="120" bgcolor = #E6F8EB>PPR?</td>
        <td width="120" bgcolor = #E6F8EB>Location General</td>
        <td width="120" bgcolor = #E6F8EB>Location Grid Ref:</td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB textcolor = #AC1636><strong><? echo cr($rs["height_above"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["mb_diff"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["alternative"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["ppr"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["general_location"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["location_grid"]); ?></strong></td>
      </tr>
      <tr>
        <td bgcolor = #f7e5c6>Runway Numbers</td>
        <td bgcolor = #f7e5c6>Circuit Direction</td>
        <td bgcolor = #f7e5c6>Circuit Height</td>
        <td bgcolor = #f7e5c6>Runway Length</td>
        <td bgcolor = #f7e5c6>Runway Surface</td>
        <td bgcolor = #f7e5c6>Food? </td>
      </tr>
      <tr>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["runway_numbers"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["circuit_direction"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["circuit_height"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["runway_length"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["surface"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["food"]); ?></strong></td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB>Radio Frequency</td>
        <td bgcolor = #E6F8EB>Radio Callsign</td>
        <td bgcolor = #E6F8EB>Radio Type</td>
        <td bgcolor = #E6F8EB>Other Radio</td>
        <td bgcolor = #E6F8EB>Fuel?</td>
        <td bgcolor = #E6F8EB>Landing Fee £</td>
      </tr>
      <tr>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["radio_frequency"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["radio_callsign"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["radio_type"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["other_radio"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["fuel"]); ?></strong></td>
        <td bgcolor = #E6F8EB><strong><? echo cr($rs["landing_fee"]); ?></strong></td>
      </tr>
      <tr>
        <td bgcolor = #f7e5c6>Opperating Hrs</td>
        <td bgcolor = #f7e5c6>Maintenance</td>
        <td bgcolor = #f7e5c6>Hangarage</td>
        <td bgcolor = #f7e5c6>Parking</td>
        <td bgcolor = #f7e5c6>Accommodation</td>
        <td bgcolor = #f7e5c6>School ?</td>
      </tr>
      <tr>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["operating_hours"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["maintenance"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["hangarage"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["parking"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["accommodation"]); ?></strong></td>
        <td bgcolor = #f7e5c6><strong><? echo cr($rs["school"]); ?></strong></td>
      </tr>
      <tr>
        <td colspan="6"><p>Remarks<p><strong><? echo cr($rs["remarks"]); ?></strong></td>
      </tr>
      <tr>
        <td colspan="6"><p>Warnings:</p>
        <p><strong><? echo cr($rs["warnings"]); ?></strong></p>
        <p> </p></td>
      </tr>
      <tr>
        <td colspan="3"><p>Website: </p>
        <p><strong><? echo cr($rs["weblinks"]); ?></strong></p></td>
        <td colspan="3"><p>Operator:</p>
        <p><strong><? echo cr($rs["operator"]); ?></strong></p></td>
      </tr>
      <tr>
        <td colspan="6">Google Ifram Image<br /><strong><? echo cr($rs["google_image"]); ?></strong></td>
      </tr>
    </table>
    <p> </p>
    </body>
    </html>

     

     

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