+ Reply to Thread
Results 1 to 10 of 10

Thread: Can any one help me in PHP MYSQL

  1. #1
    bdweb is offline x10Hosting Member bdweb is an unknown quantity at this point
    Join Date
    Jul 2005
    Posts
    15

    Exclamation Can any one help me in PHP MYSQL

    T1 and t2 is the name of a two text field



    Like I created a form in that forum I create a two text field given the name t1 and t2 and a submit button and save it as test.htm



    Now I want to get the value of t1 and t2 and put it in the MYSQL database through PHP script.

    Or

    I want to search the database with the value of t1 and t2 through PHP script



    Can any one give me the solution in a simple way it will be great help for me



    Thanks in adv

  2. #2
    Brandon Guest

    Re: Can any one help me in PHP MYSQL

    inSERT inTO I think that may be the command your looking for

  3. #3
    o0slowpaul0o's Avatar
    o0slowpaul0o is offline x10 Sophmore o0slowpaul0o is an unknown quantity at this point
    Join Date
    Mar 2005
    Posts
    127

    Re: Can any one help me in PHP MYSQL

    1) show the script so far.
    2) All PHP files should be saved with the exstention of .php.

  4. #4
    binki39 Guest

    Re: Can any one help me in PHP MYSQL

    hope this hopes... after you have created the table to store the values from t1 and t1 textareas in a form, use this to store the values in those 2 variables into the database

    mysql_query("insert into NAMEOFYOURTABLE (id, t1, t2) values ('NULL', '$id', '$t1', '$t2')") or die(mysql_error());

    the id is just to identify the rows of the table

    if you just want to store those 2 values for temporary use, just use define 2 values as follow

    variable1 = $_POST['t1'];
    variable2 = $_POST['t2'];

    i think that might work.

  5. #5
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,582

    Re: Can any one help me in PHP MYSQL

    Last edited by Bryon; 07-29-2005 at 03:24 AM.

  6. #6
    chitwa is offline x10Hosting Member chitwa is an unknown quantity at this point
    Join Date
    Apr 2005
    Location
    Kenya
    Posts
    64

    Re: Can any one help me in PHP MYSQL

    That will definitely work binki39

  7. #7
    warol is offline x10Hosting Member warol is an unknown quantity at this point
    Join Date
    Aug 2005
    Posts
    7

    Re: Can any one help me in PHP MYSQL

    Quote Originally Posted by binki39
    hope this hopes... after you have created the table to store the values from t1 and t1 textareas in a form, use this to store the values in those 2 variables into the database

    mysql_query("insert into NAMEOFYOURTABLE (id, t1, t2) values ('NULL', '$id', '$t1', '$t2')") or die(mysql_error());

    the id is just to identify the rows of the table

    if you just want to store those 2 values for temporary use, just use define 2 values as follow

    variable1 = $_POST['t1'];
    variable2 = $_POST['t2'];

    i think that might work.
    this NULL value is not necessary

  8. #8
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,582

    Re: Can any one help me in PHP MYSQL

    Quote Originally Posted by warol
    Quote Originally Posted by binki39
    hope this hopes... after you have created the table to store the values from t1 and t1 textareas in a form, use this to store the values in those 2 variables into the database

    mysql_query("insert into NAMEOFYOURTABLE (id, t1, t2) values ('NULL', '$id', '$t1', '$t2')") or die(mysql_error());

    the id is just to identify the rows of the table

    if you just want to store those 2 values for temporary use, just use define 2 values as follow

    variable1 = $_POST['t1'];
    variable2 = $_POST['t2'];

    i think that might work.
    this NULL value is not necessary
    You don't need the "id" in the query either. If you leave it blank, and try to insert a row, it'll automatically insert the id in there.

  9. #9
    bdweb is offline x10Hosting Member bdweb is an unknown quantity at this point
    Join Date
    Jul 2005
    Posts
    15

    Re: Can any one help me in PHP MYSQL

    Thanks and i finaly make it

    But When I create a check box in a forum if the user did not select the check box and click submit it shows me,
    Notice: Undefined index: php in c:\program files\easyphp1-8\www\webhosting\view.php on line 9

    I use this funtion to call the variable from a forum


    $php = $HTTP_POST_VARS['php'];

    view.php

    Which command or fution shall I use for check box
    Can any one help me about this

    Thanks in adv
    Last edited by bdweb; 08-03-2005 at 09:15 AM.

  10. #10
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,582

    Re: Can any one help me in PHP MYSQL

    Quote Originally Posted by bdweb
    Thanks and i finaly make it

    But When I create a check box in a forum if the user did not select the check box and click submit it shows me,
    Notice: Undefined index: php in c:\program files\easyphp1-8\www\webhosting\view.php on line 9

    I use this funtion to call the variable from a forum


    $php = $HTTP_POST_VARS['php'];

    view.php

    Which command or fution shall I use for check box
    Can any one help me about this

    Thanks in adv

    Checkbox's took me a while to get used to using, and get "proficient" at using them. Is what you are doing is trying to make it so you can tell if a checkbox was checked or not? I think that's what you mean. Anyways, if you have to make a checkbox:

    Code:
     <input type="checkbox" name="php" value="1">
    You can then check if it was checked when the form was submitted by doing:

    Code:
    if ($_POST['php'] == 1) { 
    	$checked = 1; 
    			 } else { 
    	$checked = 0;
    			 }
    
    if ($checked == 0) {
    
    // Do whatever, the checkbox was not checked.
    
    			 } else {
    
    // The checkbox was checked.
    
    			 }
    That right there is the method that I use to check if a checkbox is checked. I'm still not sure if that's what you meant, or needed. Also, you should use the "$_POST" global array instead of "$HTTP_POST_VARS". If you need anymore help, if this even was help, PM me, or just post in here...

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 08:27 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 11:07 AM
  3. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 10:16 PM
  4. Some help with some php mysql communication.
    By Sheepoholics in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 04-01-2006, 04:34 PM
  5. Have a problem with my forum
    By tikloos in forum Scripts & 3rd Party Apps
    Replies: 43
    Last Post: 01-19-2006, 02:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers