SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    newbie prob - combo boxes

    hi all,

    basically what i am trying to do is to create a registeration system whereby upon filling in detials in a form the user hits submit then their details are echoed back to them in another page which contains hidden variables of everything entered in the form. From here the user will hit submit then will be redirected to the last page which will give a message saying their detials have been input to the database. the only prob i have is that regarding normal text inputs everything is ok, however combo boxes or select boxes are a real problem for me BIG TIME . i keep getting blank entrys as far as these are concerned i need some suggestions as to what i could be doing wrong. also the combo boxes should contain a single value. also what is weird is when printing back the combo boxed variables in the second page it works fine but when going to the third page which calls a method from another page to insert the data the only thing that appears the record is the firstname and surname of the user.let me know asap!

    thanks for your time.

    Last edited by madhavr; Aug 22, 2001 at 11:47.
    signature

  2. #2
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably need to see the code from that second page, and possibly, the method. Could be a lot of things

  3. #3
    SitePoint Member
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    the code

    heres the code from the second page .....


    <HTML>
    <HEAD>
    <FONT FACE="VERDANA" SIZE="2">
    <TITLE> - - </TITLE>
    <CENTER>
    <H1>CONFIRMATION FORM</H1>
    </CENTER>
    </HEAD>
    <?PHP
    INCLUDE("common.php");


    ?>
    <BODY BGCOLOR="#FFFFCC">


    <FORM NAME="FORM2" METHOD="POST" <FORM ENCTYPE="MULTIPART/FORM-DATA" ACTION="result.php">
    <BR>
    <CENTER>
    <TABLE BORDER=1 WIDTH='30%' CELLSPACING="0" CELLPADDING="10" HEIGHT="75" BGCOLOR="#CCCCCC" BORDERCOLOR = "BLACK">


    <TR>
    <TD>
    <FONT FACE="VERDANA" SIZE="2">
    <?php
    include("dbm.php");
    $file_url = "";
    $file_dir = "";

    if ( isset($fupload))
    {

    if ( $fupload_type == "image/pjpeg" or $fupload_type == "image/gif")
    {
    copy ($fupload, "$file_dir/$fupload_name") or die ("could'nt copy");
    print "<center><img src=\"$file_url/$fupload_name\"></center><p>\n\n";
    }

    }
    print "<center>If you have chosen not to submit an image of yourself, so ignore this message <br><b><u>or</u></b><br>
    you have chosen a wrong image type please choose either a gif or a jpeg if you wish
    to submit an image of yourself</center><br>";
    ?>
    </FONT>
    </TD>
    </TR>
    <TR>
    <TD>
    <FONT FACE ="VERDANA" SIZE="1">
    <?php
    if ( isset ($fupload) )
    {
    print "name of image file : \n <i>$fupload_name</i><br>";
    print "size of image file : \n <i>$fupload_size bytes</i><br>";
    print "type of image file : \n <i>$fupload_type</i><br><br>";
    }
    ?>
    </TD>
    </TR>
    <TD>
    <FONT FACE ="VERDANA" SIZE="1">

    <?PHP

    PRINT "THESE ARE YOUR DETAILS PLEASE CONFIRM..... <BR>\n\n";
    PRINT "YOUR USERNAME IS: \n\n <B>$UNAME</B> <BR>";
    PRINT "YOUR PASSWORD IS: \n\n <B>$PASSWORD</B> <BR>";
    PRINT "YOUR FIRSTNAME IS: \n\n <B>$FNAME</B> <BR>";
    PRINT "YOUR SURNAME IS: \n\n <B>$SNAME</B> <BR>";



    PRINT "YOUR ARE \n\n <B>$AGE</B>\n YEARS OLD <BR>";


    FOREACH ( $COB[] AS $VALUE )
    {
    PRINT "YOUR COUNTRY OF BIRTH IS: \n\n <B>$VALUE</B> \n <BR>";
    }

    FOREACH ( $SEX AS $VALUE )
    {
    PRINT "YOUR ARE \n\n <B>$VALUE</B> \n <BR>";
    }

    PRINT "YOUR HEIGHT IS \n\n ";

    FOREACH ( $FEET AS $VALUE )
    {
    PRINT "<B>$VALUE</B> \n FT \n ";
    }

    FOREACH ($INCHES AS $VALUE)
    {
    PRINT "<B>$VALUE</B> \n INCHES \n <BR>";
    }

    PRINT "YOUR RELIGION IS \n\n $RELIGION\n <BR>";

    FOREACH ($HAIR AS $VALUE)
    {
    PRINT "YOUR HAIR COLOUR IS \n\n <B>$VALUE</B>\n <BR>";
    }

    FOREACH ($EYES AS $VALUE)
    {
    PRINT "YOUR EYES ARE \n\n <B>$VALUE</B>\n <BR>";
    }

    FOREACH ($SKINCOLOR AS $VALUE)
    {
    PRINT "YOUR SKIN IS \n\n <B>$VALUE</B>\n <BR>";
    }
    FOREACH ($BUILD AS $VALUE)
    {
    PRINT "YOUR BUILD IS \n\n <B>$VALUE</B>\n <BR>";
    }
    FOREACH ($STAR AS $VALUE)
    {
    PRINT "YOUR STAR SIGN IS \n\n $VALUE\n <BR>";
    }

    // DONT SHOW CAST IF ITS NOT FILLED IN!
    IF (! ISSET($CASTE))
    {
    FOREACH ($CASTE AS $VALUE)
    {
    PRINT "YOUR CASTE IS \n\n <B>$VALUE</B>\n <BR>";
    }

    }

    PRINT "YOUR INTERESTS ARE \n\n $HOBBIES\n <BR>";
    PRINT "YOUR ADDRESS IS \n\n $ADDRESS\n <BR>";
    PRINT "YOUR TELEPHONE NUMBER IS \n\n $TEL\n <BR>";

    IF ( ISSET($EMAIL))
    {
    PRINT "YOUR E-MAIL IS \n\n <B>$EMAIL</B>\n <BR>";
    }
    ELSE
    {
    PRINT "<B>YOU MUST FILL IN YOUR EMAIL ADDRESS</B>\n\n<BR>";
    }

    IF ( ISSET($FAX))
    {
    PRINT "YOUR FAX NO IS <B>$FAX</B>\n\n<BR>";
    }
    ELSEIF (! ISSET($FAX))
    {
    // DO NOTHING!
    }

    print "<BR>";
    print "<CENTER><INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT></CENTER>";

    print "<INPUT TYPE=HIDDEN NAME=memno VALUE=$memno>";
    print "<INPUT TYPE=HIDDEN NAME=FNAME VALUE=$FNAME>";
    print "<INPUT TYPE=HIDDEN NAME=SNAME VALUE=$SNAME>";
    print "<INPUT TYPE=HIDDEN NAME=COB[] VALUE=$COB>";
    print "<select type=hidden name=SEX value=$SEX>";

    // print "<INPUT TYPE="HIDDEN" NAME="UNAME" VALUE="<?PHP ECHO


    print "</FORM>";

    ?>


    </TD>
    </TR>
    </TABLE>
    </FONT>
    </BODY>
    </HTML>



    heres the code from the third page......


    <HTML>
    <HEAD>
    <form >
    <INPUT TYPE="HIDDEN" NAME="memno" VALUE="<?PHP ECHO(@$memno); ?>">
    <INPUT TYPE="HIDDEN" NAME="FNAME" VALUE="<?PHP ECHO(@$FNAME); ?>">
    <INPUT TYPE="HIDDEN" NAME="SNAME" VALUE="<?PHP ECHO(@$SNAME); ?>">
    <INPUT TYPE="HIDDEN" NAME="SEX[]" VALUE="<?PHP ECHO(@$SEX); ?>">
    <INPUT TYPE="HIDDEN" NAME="UNAME" VALUE="<?PHP ECHO(@$UNAME); ?>">
    <INPUT TYPE="HIDDEN" NAME="PASSWORD" VALUE="<?PHP ECHO(@$PASSWORD); ?>">
    <INPUT TYPE="HIDDEN" NAME="SEX" VALUE="<?PHP ECHO(@$SEX); ?>">
    <INPUT TYPE="HIDDEN" NAME="AGE" VALUE="<?PHP ECHO(@$AGE); ?>">
    <INPUT TYPE="HIDDEN" NAME="FEET" VALUE="<?PHP ECHO(@$FEET); ?>">
    <INPUT TYPE="HIDDEN" NAME="INCHES" VALUE="<?PHP ECHO(@$INCHES); ?>">
    <INPUT TYPE="HIDDEN" NAME="INTERESTS" VALUE="<?PHP ECHO(@$INTERESTS); ?>">
    <INPUT TYPE="HIDDEN" NAME="ADDRESS" VALUE="<?PHP ECHO(@$ADDRESS); ?>">
    <INPUT TYPE="HIDDEN" NAME="FAX" VALUE="<?PHP ECHO(@$FAX); ?>">
    <INPUT TYPE="HIDDEN" NAME="EMAIL" VALUE="<?PHP ECHO(@$EMAIL); ?>">
    <INPUT TYPE="HIDDEN" NAME="PHOTO" VALUE="<?PHP ECHO(@$PHOTO); ?>">
    <INPUT TYPE="HIDDEN" NAME="COB[]" VALUE="<?PHP ECHO(@$COB); ?>">
    </form>

    </HEAD>
    <?PHP
    INCLUDE("common.php");
    include("dbm.php");
    INCLUDE("validate.php");
    ?>

    <BODY>


    <?PHP
    IF ("SUBMIT" == @$SUBMIT) {
    // the function
    insertRecord(
    $UNAME,$PASSWORD,$PHOTO,$FNAME,$SNAME,$SEX,$AGE,$FEET,$INCHES,
    $HAIR,$EYES,$BUILD,$RELIGION,$CAST,$INTERESTS,$ADDRESS,$TEL,$EMAIL,$FAX,$COB);

    }

    ?>

    </BODY>

    </HTML>

    heres the code from dbm.php

    <?php
    include("dbg.inc");
    //the function
    function insertRecord(
    $UNAME,$PASSWORD,$PHOTO,$FNAME, $SNAME,$SEX,$AGE,$FEET,$INCHES,
    $HAIR,$EYES,$BUILD,$RELIGION,$CAST,$INTERESTS,$ADDRESS,$EMAIL,$FAX,$COB)
    {
    $sql = "INSERT INTO MEMBER (
    username, password, photo, forename, surname, sex, age, feet,inches,
    body, religion, cast, hobbies, email, COB)
    VALUES (
    '$UNAME','$PASSWORD','$PHOTO','$FNAME', '$SNAME','$SEX','$AGE','$FEET','$INCHES',
    '$BODY','$RELIGION','$CAST','$INTERESTS','$EMAIL','$COB'
    )";

    if (mysql_query($sql)) {
    echo("<P>Thank you $FNAME $SNAME your Details have been submitted to the database,
    you will recieve an e-mail within 24 hours.</P>");

    } else {
    echo("<P>Error adding Your Details, please try again.
    If it continues contact : " .
    mysql_error() . "</P>");
    }

    }

    ?>

    its all really messed up please tell me what you think asap. thanks
    Last edited by madhavr; Aug 23, 2001 at 06:12.
    signature


Bookmarks

Posting Permissions

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