Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Location
    Nigeria
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry How do i store and call images in php

    please I want to create a form to enable people submit there data including a passport to the database and thereafter print an acknowledgement which should include their passport. this is the code I used

    PHP Code:
    <html>
    <head>
    <title>Proficiency Certificate in Management Examination</title>
    <style type="text/css">
    .Title {
        color: #FFFF00;
        font-weight: bold;
        font-size: 16px;
        Background-color:0000ff;
    }
    input{
    Background-color:FFFFDD;
    font-family: verdana;
    font-size:10px;
    width:170;
    }
    table
    {
    width:70%;
    border: 1px solid #000000;
    font-family:Tahoma; font-weight:bold; font-size:11px;
    }
    tr
    {
    Background-color:;
    }
    td
    {
    padding-left:5px;
    padding-top:5px;
    }
    .button
    {
    border:4px groove #cccccc;
    background-color:#ccccdd;
    margin-top:5px;
    margin-bottom:5px;
    }
    .msg {
        color: #00FFAA;
        font-weight: bold;
        font-size: 12px;
            width:100%;
            border:1px solid #cccccc;
            text-align:center;
        Background-color:FFFFDD;
    }

    </style>

    </head>

    <body topmargin="0">



    <?php

    if (isset($_POST['submit'])) {

    // form submitted
    // set server access variables


    $serverhost="";
    $userval="XXXXXXXX";
    $pass="xxxxxxxx";
    $db="eeeeeeeee";



    // get form input
    // check to make sure it's all there
    // escape input variables for grater safety

    $surname=$_POST['surname'];
    $othername=$_POST['othernames'];
    $sex=$_POST['sex'];
    $sddress=$_POST['address'];
    $emailaddress=$_POST['emailaddress'];
    $mobilephone=$_POST['mobilephone'];
    $subjects=$_POST['subjects'];
    $tellernumber=$_POST['tellernumber'];
    $amountpaid=$_POST['amountpaid'];
    $examcenter=$_POST['examcenter'];
    $passport=$_POST['mobilephone'];



    // open connection
    $conn mysql_connect($serverhost$userval$pass) or die ("unable to connect!");

    // select databse
    $datVal =  mysql_select_db($db,$conn) or die ("unable to select database!");

    // create query
    $query="INSERT INTO XXXXXX (surname, othernames,  sex, address, emailaddress, mobilephone, subjects, tellernumber, amountpaid, 
    examcenter, passport)VALUES ('$surname','$othernames','$sex','$address','$emailaddress', '$mobilephone', '$subjects', '$tellernumber','$amountpaid','$examcenter','$passport')"
    ;

    //echo $query;
    // execute query
    $result=mysql_query($query,$conn) or die ("error on query: $query.".mysql_error());


    //print the input supplied by the user
    echo "<br>\n";
    echo 
    "<br>\n";
    echo 
    "<br>\n";
    echo 
    "<table cellpadding=10 border=1 align=center width=50%>";


    echo 
    "<tr align=center>";
    echo 
    "<td COLSPAN=2 bgcolor=#66ffff><b><font color=blue size=2>NIGERIAN INSTITUTE OF MANAGEMENT (CHARTERED)</font></b></td>";
    echo 
    "</tr>";
    echo 
    "<tr align=center>";
    echo 
    "<td COLSPAN=2><b><font color=red>PROFICIENCY CERTIFICATE IN MANAGEMENT</font></b></td>";
    echo 
    "</tr>";
    echo 
    "<tr align=center>";
    echo 
    "<td COLSPAN=2 bgcolor=blue><b><font color=white>EXAMINATION ENTRY SLIP</font></b></td>";
    echo 
    "</tr>";


    echo 
    "<tr>";
    echo 
    "<td><b>PASSPORT PHOTOGRAPH</b></td>";
    echo 
    "<td>$passport</td>";




    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td><b>SURNAME</b></td>";
    echo 
    "<td>$surname</td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td><b>OTHER NAMES</b></td>";
    echo 
    "<td>$othernames</td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td><b>EXAMINATION CENTER</b></td>";
    echo 
    "<td>$examcenter</td>";
    echo 
    "</tr>";


    echo 
    "<tr align=center>";
    echo 
    "<td COLSPAN=2 bgcolor=#ccffff><b><font color=blue>Your Registration was successful. Please, Print this page and come along with it to the examination venue.</font></b></td>";
    echo 
    "</tr>";


    echo 
    "<tr align=center>";
    echo 
    "<td COLSPAN=2 bgcolor=white><b><font color=red>Please NOTE that you will not be allowed into the Examination hall without this slip. Thank you
    </font></b></td>"
    ;
    echo 
    "</tr>";

                  
    echo 
    "</table>";


    // close connection
    mysql_close($conn);


    }
    ?>



        
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p><br>
    &nbsp;</p>


    </body>
    </html>
    The data gets submitted correctly but when printing the data supplied by user, the passport photo doesn't show please help!!!!!!!!!!!!!

  • #2
    Regular Coder
    Join Date
    Jun 2010
    Location
    Earth
    Posts
    305
    Thanks
    27
    Thanked 2 Times in 2 Posts
    Here are some tutorials on how to upload an image to MySQL & how to display it

    http://forum.codecall.net/topic/4028...ysql-with-php/
    http://forum.codecall.net/topic/4084...y-your-images/

    Also, you have these as the same
    PHP Code:
    $mobilephone=$_POST['mobilephone']; 
    $passport=$_POST['mobilephone']; 


  •  

    Tags for this Thread

    Posting Permissions

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