Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 22nd, 2004, 08:34 AM
Registered User
 
Join Date: Dec 2004
Location: dhaka, , Bangladesh.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to LogicalDevloper
Default cannot insert into mysql:data

i have problem
problem:
when i try to insert usinga html form
it inserts a new record but no data is inserted.



code for html form:


   <html>


<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>::beebaho.com::</title>
</head>

<body topmargin="0">

<div align="center">
  <center>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#D7E1EC" width="772" height="155">

    <tr>
      <td width="770" height="1" valign="top">
      <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/banner2.jpg" width="770" height="39"></td>
    </tr>

    <tr>
      <td width="770" height="1" valign="top" background="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/pg_topdecoration.gif">&nbsp;</td>
    </tr>
    <tr>
      <td width="770" height="18" valign="top">
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" height="19">
        <tr>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">
          Home</td>
          <td width="11%" bgcolor="#B4C8DC" height="19">
          <p align="center">Planning</td>
          <td width="9%" bgcolor="#B4C8DC" height="19">
          <p align="center">Support</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">Privacy</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">Bride</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">Groom</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">Events</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">Dating</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">
          Advertise</td>
          <td width="10%" bgcolor="#B4C8DC" height="19">
          <p align="center">Terms</td>
        </tr>
      </table>
      </td>
    </tr>
    <tr>
      <td width="770" height="234" valign="bottom" bgcolor="#EAEFF4">
      <p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="101%" height="17">
        <tr>
          <td width="1%" valign="top" height="16" bgcolor="#EAEFF4">
          <p align="center">&nbsp;</td>
          <td width="33%" valign="top" height="16" colspan="2" bgcolor="#EAEFF4">&nbsp;</td>
          <td width="66%" valign="top" height="16" colspan="5" bgcolor="#EAEFF4">
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/motto2.jpg" align="left" width="302" height="24"></td>
        </tr>
        <tr>
          <td width="2%" valign="top" height="155" rowspan="6" bgcolor="#EAEFF4">&nbsp;<p>&nbsp;</p>
          <p align="center">&nbsp;</td>
          <td width="26%" valign="top" height="155" rowspan="6" bgcolor="#D7E1EC">
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/registration.jpg" width="255" height="39"><p>
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/ragist_graphic.jpg" width="255" height="84"></p>
          <p align="left">&nbsp;&nbsp;&nbsp;&nbsp; Already Registered ?
          &nbsp;Login</td>
          <td width="1%" height="155" rowspan="6" background="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/dot2.jpg">&nbsp;</td>
          <td width="2%" height="155" rowspan="6" bgcolor="#D7E1EC">&nbsp;</td>
          <td width="50%" height="59" bgcolor="#D7E1EC">&nbsp;</td>

          <td width="15%" height="155" rowspan="6" bgcolor="#D7E1EC" background="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/cell_bg2.jpg">
          <p align="center">&nbsp;</td>
          <td width="2%" height="155" rowspan="6" bgcolor="#EAEFF4">&nbsp;</td>
          <td width="2%" height="155" rowspan="6">&nbsp;</td>
        </tr>
        <tr>
          <td width="50%" height="14" bgcolor="#D7E1EC"><i>
          The beebaho.com
          Advantage :</i></td>
        </tr>
        <tr>
          <td width="50%" height="24" bgcolor="#D7E1EC">
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/square1.gif" width="3" height="3">
          High
          Authenticity-
          Access
          Screened profile</td>
        </tr>
        <tr>
          <td width="50%" height="22" bgcolor="#D7E1EC">
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/square1.gif" width="3" height="3">
          Total
          Privacy-
          Control
          visibility of your photos</td>
        </tr>
        <tr>
          <td width="50%" height="23" bgcolor="#D7E1EC">
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/square1.gif" width="3" height="3">

          beebaho.com exclusive-Exclusive
          features on every item</td>
        </tr>
        <tr>
          <td width="50%" height="7" bgcolor="#D7E1EC">&nbsp;</td>
        </tr>
        <tr>
          <td width="100%" valign="top" height="17" colspan="8" bgcolor="#EAEFF4">&nbsp;</td>
        </tr>
      </table>
      </td>
    </tr>
    <tr>
      <td width="770" height="111" valign="bottom" bgcolor="#D7E1EC">
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="74">
        <tr>
          <td width="1%" bgcolor="#EAEFF4" rowspan="14" height="1">&nbsp;</td>
          <td width="98%" bgcolor="#B4C8DC" colspan="6" height="19">
          <p align="center">

          Note: All fields are compulsory. Please enter accurate
          information in this form or your profile may be declined.&nbsp;
          &nbsp;&nbsp;
          </td>
          <td width="1%" bgcolor="#EAEFF4" rowspan="14" height="1">&nbsp;</td>
        </tr>
        <tr>
          <td width="98%" height="19" colspan="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/underline.jpg" width="600" height="13"></td>
        </tr>
        <form name="beereg1" action="insertReg2.php?" method="post">
        <tr>
          <td width="19%" height="19">
          &nbsp; Profile created by</td>
          <td width="1%" height="19">&nbsp;</td>
          <td width="31%" height="19" colspan="3">
          <select name="ddrelationship" class="formselect" style="font-family: Verdana; font-size: 9px" tabindex="0"><option value="">Select</option><option>Self</option><option>Parent / Guardian</option><option>Sibling</option><option>Friend</option><option>Other</option></select></td>
          <td width="47%" height="43" rowspan="3">
          Profile ID must have minimum 4 characters &amp; no special characters. It cannot be changed later. <br>
        You will be known on the site by this name, e.g. a Profile with ID 'Anand' will be seen as Anand's profile.</td>
        </tr>
        <tr>


          <td width="9%" height="19">&nbsp;</td>
          <td width="17%" height="19">&nbsp;</td>
          <td width="5%" height="19">&nbsp;</td>
        </tr>
        <tr>
          <td width="19%" height="5">
          &nbsp; Profile ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
          <td width="1%" height="5"></td>
          <td width="31%" height="5" colspan="3">
        <input name="txtProfile" value="" class="forminput" type="text" size="20" tabindex="1"></td>
        </tr>
        <tr>
          <td width="19%" height="19">
          &nbsp; Email&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp; </td>
          <td width="1%" height="19">&nbsp;</td>
          <td width="31%" height="19" colspan="3">
          <input name="txtEmail" value="" class="forminput" size="30" type="text" tabindex="2" Onblur="chkmail()"></td>
          <td width="47%" height="16" rowspan="2">
          Please enter your email correctly. You will be logging in using this email. We will send you member responses here.</td>
        </tr>
        <tr>
          <td width="19%" height="1"></td>
          <td width="1%" height="1"></td>
          <td width="9%" height="1"></td>
          <td width="17%" height="1"></td>
          <td width="5%" height="1"></td>
        </tr>
        <tr>
          <td width="19%" height="27">
          &nbsp; Confirm Email</td>
          <td width="1%" height="27">&nbsp;</td>
          <td width="31%" height="27" colspan="3">
          <input name="email2" value="" class="forminput" size="30" type="text" tabindex="3"></td>
        </tr>
        <tr>
          <td width="98%" height="19" colspan="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <img border="0" src="../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/beebaho.com/final%20site/images/underline.jpg" width="600" height="13"></td>
        </tr>
        <tr>
          <td width="19%" height="30">
          &nbsp;
          Password</td>
          <td width="1%" height="30">&nbsp;</td>
          <td width="31%" height="30" colspan="3">
        <input name="txtPass" value="" class="forminput" type="password" size="20" tabindex="4"></td>
          <td width="47%" height="30">
          min 10 char,no special characters</td>
        </tr>
        <tr>
          <td width="19%" height="36">&nbsp;confirm
          password&nbsp;&nbsp;&nbsp;&nbsp; </td>
          <td width="1%" height="36">&nbsp;</td>
          <td width="31%" height="36" colspan="3">
        <input name="password2" value="" class="forminput" type="password" size="20" tabindex="5"></td>
          <td width="47%" height="36">
          enter exactly same above password</td>
        </tr>
         <tr>
          <td width="17%" height="1">&nbsp;Gender</td>
          <td width="1" height="1">&nbsp;<p>&nbsp;</td>
          <td width="31%" height="1" colspan="3">
        <input type="radio" value="V3" checked name="R1" tabindex="6">&nbsp; male&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="radio" name="R1" value="V4" tabindex="7">female </td>
          <td width="47%" height="1">
          </td>
        </tr>
          <tr>
          <td width="19%" height="24">&nbsp; Date
          of birth&nbsp;&nbsp; </td>
          <td width="1%" height="24">&nbsp;</td>
          <td width="31%" height="24" colspan="3">
        <select size="1" name="D1" tabindex="8">
        <option>Day</option>
        <option>02</option>
        <option>03</option>
        <option>04</option>
        <option>05</option>
        <option>06</option>
        <option>07</option>
        <option>09</option>
        <option>10</option>
        <option>11</option>
        <option>12</option>
        <option>13</option>
        <option>14</option>
        <option>15</option>
        <option>16</option>
        <option>17</option>
        <option>18</option>
        <option>19</option>
        <option>20</option>
        <option>21</option>
        <option>22</option>
        <option>23</option>
        <option>24</option>
        <option>25</option>
        <option>26</option>
        <option>27</option>
        <option>28</option>
        <option>29</option>
        <option>30</option>
        <option>31</option>
        <option>01</option>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;
        <select size="1" name="D2" tabindex="9">
        <option>Month</option>
        <option>Januarary</option>
        <option>February</option>
        <option>March</option>
        <option>April</option>
        <option>May</option>
        <option>June</option>
        <option>July</option>
        <option>August</option>
        <option>September</option>
        <option>October</option>
        <option>November</option>
        <option>December</option>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;
        <select size="1" name="D3" tabindex="10">
        <option>Year</option>
        <option>1961</option>
        <option>1962</option>
        <option>1963</option>
        <option>1964</option>
        <option>1970</option>
        <option>1971</option>
        <option>1972</option>
        <option>1973</option>
        <option>1974</option>
        <option>1975</option>
        <option>1975</option>
        <option>1976</option>
        <option>1977</option>
        <option>1978</option>
        <option>1979</option>
        <option>1979</option>
        <option>1980</option>
        <option>1981</option>
        <option>1982</option>
        <option>1983</option>
        <option>1984</option>
        <option>1985</option>
        <option>1986</option>
        <option>1935</option>
        <option>1936</option>
        <option>1937</option>
        <option>1938</option>
        <option>1939</option>
        <option>1940</option>
        <option>1941</option>
        <option>1942</option>
        <option>1941</option>
        <option>1942</option>
        </select> </td>
          <td width="47%" height="24">
          &nbsp;enter date of birth dd/mm/yyyy</td>
        </tr>
          <tr>
          <td width="19%" height="25">
          &nbsp; Religion</td>
          <td width="1%" height="25">&nbsp;</td>
          <td width="31%" height="25" colspan="3">
        <select size="1" name="Relg1" tabindex="11">
        <option selected>Religion</option>
        <option value="Muslim">Muslim</option>
        <option value="Muslim|Dhaka">-Dhaka</option>
        <option value="Muslim|Syhleti">-Syhleti</option>
        <option value="Muslim|Chittagongi">-Chittagongi</option>
        <option value="Muslim|Rajshahi">-Rajshahi</option>
        <option value="Muslim|Tangaili">-Tangail</option>
        </select></td>
          <td width="47%" height="25">
          min 10 char,no special characters</td>
        </tr>







<script language="JavaScript">
function valDt()
{
if(document.beereg1.txtProfile.value=="")
    {
    alert("Enter Profile Name");
    document.beereg1.profile.focus();
    return;
    }
    else if(document.beereg1.txtEmail.value=="")
    {
    alert("Enter email")
    document.beereg1.contactp.focus();
    return;
    }


else if(document.beereg1.email2.value=="")
    {
    alert("retype email")
    document.beereg1.email2.focus();
    return;
    }



}

 function chkmail()
  {
    var mail1=new String("");
    var mail1=document.beereg1.txtEmail.value;
    //var chkmStr=new String("yahoomail");
    var cont=/\@/;
    var dot=/\./;

    var str2=mail1.search(cont);
    var str3=mail1.search(dot);

    if(str2==-1|| str3==-1){
    alert("enter correct email address")
    document.beereg1.txtEmail.value="";

    return;
    }else{

       document.close();

       }

    }




//else if((document.beereg1.category.options[document.beereg1.category.selectedIndex].value!="select") && (document.beereg1.scategory.value!=""))
//{
//alert("Either Select/Suggest a Category.");
//document.beereg1.scategory.focus();
//document.beereg1.scategory.select();
//return ;
//}

//else
//{
//document.beereg1.submit();
//return;
//}

//}






        </script>


          <tr>
          <td width="1%" bgcolor="#EAEFF4" height="24">&nbsp;</td>
          <td width="19%" height="33">
          &nbsp; Country Of residence</td>
          <td width="1%" height="30">&nbsp;</td>
          <td width="31%" height="30" colspan="3">
        <select size="1" name="resC" tabindex="12">
        <option>Country</option>
        <option>Bangladesh</option>
        <option>India</option>
        <option>Pakistan</option>
        </select></td>
          <td width="47%" height="30">
          &nbsp;</td>
          <td width="1%" bgcolor="#EAEFF4" height="24">&nbsp;</td>
        </tr>





          <tr>
          <td width="1%" bgcolor="#EAEFF4" height="11">&nbsp;</td>
          <td width="98%" height="36" colspan="6" rowspan="2">
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
         <input type="submit" value="" name="B1" style="width: 80; height: 25; background-image: url('../../../../../../Personal/floppy/WEBsiteDEV/BeeBaho.com/shaadi/reg_files/continue.gif'); background-repeat:no-repeat; background-attachment:fixed" Onclick='valDt()'></td>
          <td width="1%" bgcolor="#EAEFF4" height="11">&nbsp;</td>
        </tr>

        </form>



          <tr>
          <td width="1%" bgcolor="#EAEFF4" height="13">&nbsp;</td>
          <td width="1%" bgcolor="#EAEFF4" height="13">&nbsp;</td>
        </tr>

<?php

?>








</html>


code for insert



  <?php
     require("beebahomain.php");


        $post=$HTTP_VARS_POST["ddrelationship"];

         $UserN= $HTTP_GET_POST["txtProfile"];
         $email=$HTTP_VARS_POST["txtEmail"];
         $pass1=$HTTP_VARS_POST["txtPass"];
        // $gen=$HTTP_VARS_POST["R1"];
         $Yr=$HTTP_VARS_POST["yr"];
         $Mon=$HTTP_VARS_POST["month"];
         $D1=$HTTP_VARS_POST["Day1"];
         $relg=$HTTP_VARS_POST["Relg1"];
         $ResCnt=$HTTP_VARS_POST["resC"];



    class insertReg2 extends beebaho
    {


             function Con($db)
             {
                   beebaho::Connect();

                    MYSQL_SELECT_DB("$db");
                    global $pass1;

                    echo $pass1;

                        }

                         function GenID($link,$query)
                         {

                            global $ID,$ID2,$result,$row,$link,$query,$num1,$ResCnt;


                             $result=mysql_query("SELECT id FROM bbhcan1 ");
                              $num1=mysql_num_rows($result);
                             // echo $num1;
                              $num1=$num1+1;
                              $d="Usr";
                               $USERID=$d.$num1;
                               //echo $USERID;



                          }

                          function getD()
                          {
                            global $Yr,$Mon,$D1;
                            $date=$Yr.$Mon.$D1;
                            echo $date;
                            }


                         function insert($link,$query)
                          {

                             global $USERID,$post,$UserN,$email,$pass1,$gen1,$date1,$r elg,$num1,$ResCnt;
                            $query ="INSERT into bbhcan1(profC,profN,email,password,relg,countR) VALUES('$post','$UserN','$email','$pass1','$relg', '$ResCnt')";
                            //$query1="INSERT into canddetails(AccNo) Values('$Act')";
                            mysql_query($query,$link)
                             or die("Could'nt add data to table".mysql_error());
                                  mysql_close($link);



                          }



    }


                       $InREG=new insertReg2();
                       $InREG->Con($db);
                      //$InREG->GenID($link,$query);
                       //$InREG->getD();
                       $InREG->insert($link,$query);


    ?>



Prob:
i maen everything is ok
id is autoincremented meanining
there is insertation but no data is inserted from form(html)





The impossible does not exist
Reply With Quote
  #2 (permalink)  
Old December 22nd, 2004, 09:08 AM
Friend of Wrox
 
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

see if { register_globals = On } is disabled in php.ini
use $_POST or $_GET lieu $HTTP_VARS
also, validate ur data server-side before u dump into db

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert datatable data in mysql with dnn rizwanrizi SQL Server ASP 0 August 26th, 2008 05:36 AM
PHP-MySQL Insert Data problem forexen PHP Databases 1 March 13th, 2007 12:58 AM
Im trying to insert data into mysql using jsp paulhamo SQL Language 1 September 12th, 2006 02:35 AM
INSERT with MySQL sethtrain BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 August 1st, 2006 06:38 AM
insert null value in MySql? donh BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 November 28th, 2003 11:55 PM



All times are GMT -4. The time now is 09:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.