From: "Payne" [ref] > I am working a form to pass information from it to mysql data. I am > able to connect to the database. But nothing is being pass from the form > to the php page. This is my php code... > ---------------------form.html--------------------------------------------[/ref] --------[ref] > > > Untitled > > > >
> > > > >
> > > --------------------------addleads.php------------------------------------[/ref] ------[ref] > > include("./config.php"); > > $sql = "INSERT INTO $table_name > (leads_id, title, f_name, l_name) > VALUES > ('$leads_id', \"$title\", \"$f_name\", \"$l_name\")"; > > //debug tool > > print $sql; > > $result = mysql_query($sql, $connection) or > die ("Couldn't execute query."); > > ?> > > > Untitled > > > > > > >
> >
> > > --------------------------------------------------------------------------[/ref] ---------[ref] > > What I am getting this.... > > INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ('', "", "",[/ref] "")[ref] > > *Salutation* > *First Name* > *Last Name*[/ref] <-- snip --> [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <002501c38911$e7beb3f0$a200a8c0@CANCoaVan.cancoach.com> [ref] => <3F7C698A.1020900@magidesign.com> [htmlstate] => on_nl2br [postusername] => Chris [ip] => csherwood@norti [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> >From: "Payne" > >[ref] >>I am working a form to pass information from it to mysql data. I am >>able to connect to the database. But nothing is being pass from the form >>to the php page. This is my php code... >>---------------------form.html-------------------------------------------- >> >>[/ref] >-------- > >[ref] >> >> >> Untitled >> >> >> >>
>> >> >> >> >>
>> >> >>--------------------------addlead.php------------------------------------ >> >>[/ref] >------ > >[ref] >>> >>include("./config.php"); >> >>$sql = "INSERT INTO $table_name >> (leads_id, title, f_name, l_name) >> VALUES >> ('$leads_id', \"$title\", \"$f_name\", \"$l_name\")"; >> >>//debug tool >> >>print $sql; >> >>$result = mysql_query($sql, $connection) or >> die ("Couldn't execute query."); >> >>?> >> >> >> Untitled >> >> >> >> >> >> >>
>> >>
>> >> >>-------------------------------------------------------------------------- >> >>[/ref] >--------- > >[ref] >>What I am getting this.... >> >>INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ('', "", "", >> >>[/ref] >"") > >[ref] >>*Salutation* >>*First Name* >>*Last Name* >> >>[/ref] ><-- snip --> > > > >[/ref] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <3F7C6DDC.6010608@magidesign.com> [ref] => <3F7C698A.1020900@magidesign.com> <002501c38911$e7beb3f0$a200a8c0@CANCoaVan.cancoach.com> [htmlstate] => on_nl2br [postusername] => Payne [ip] => payne@magidesig [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 4 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> >From: "Payne" > >[ref] >>I am working a form to pass information from it to mysql data. I am >>able to connect to the database. But nothing is being pass from the form >>to the php page. This is my php code... >>---------------------form.html-------------------------------------------- >> >>[/ref] >-------- > >[ref] >> >> >> Untitled >> >> >> >>
>> >> >> >> >>
>> >> >>--------------------------addleads.php------------------------------------ >> >>[/ref] >------ > >[ref] >>> >>include("./config.php"); >> >>$sql = "INSERT INTO $table_name >> (leads_id, title, f_name, l_name) >> VALUES >> ('$leads_id', \"$title\", \"$f_name\", \"$l_name\")"; >> >>//debug tool >> >>print $sql; >> >>$result = mysql_query($sql, $connection) or >> die ("Couldn't execute query."); >> >>?> >> >> >> Untitled >> >> >> >> >> >> >>
>> >>
>> >> >>-------------------------------------------------------------------------- >> >>[/ref] >--------- > >[ref] >>What I am getting this.... >> >>INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ('', "", "", >> >>[/ref] >"") > >[ref] >>*Salutation* >>*First Name* >>*Last Name* >> >>[/ref] ><-- snip --> > > >[/ref] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <3F7C6F52.2080403@magidesign.com> [ref] => <3F7C698A.1020900@magidesign.com> <002501c38911$e7beb3f0$a200a8c0@CANCoaVan.cancoach.com> [htmlstate] => on_nl2br [postusername] => Payne [ip] => payne@magidesig [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 6 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> passing form information. - PHP Development

passing form information. - PHP Development

Hi, I am working a form to pass information from it to mysql data. I am able to connect to the database. But nothing is being pass from the form to the php page. This is my php code... ---------------------form.html---------------------------------------------------- <html> <head> <title>Untitled</title> </style> </head> <body> <form name="form1" method="post" action="addlead.php"> <input name="title" type="text" size="40"> <input name="f_name" type="text" size="40"> <input name="l_name" type="text" size="40"> <input type="submit" name="Submit" value="Submit Information"> </form> </body> </html> --------------------------addleads.php------------------------------------------ <? include("./config.php"); $sql = "INSERT INTO $table_name (leads_id, title, f_name, l_name) VALUES ('$leads_id', \"$title\", \"$f_name\", \"$l_name\")"; //debug tool print $sql; $result = mysql_query($sql, $connection) or die ("Couldn't execute query."); ...

  1. #1

    Default passing form information.

    Hi,

    I am working a form to pass information from it to mysql data. I am
    able to connect to the database. But nothing is being pass from the form
    to the php page. This is my php code...


    ---------------------form.html----------------------------------------------------


    <html>
    <head>
    <title>Untitled</title>
    </style>
    </head>
    <body>
    <form name="form1" method="post" action="addlead.php">
    <input name="title" type="text" size="40">
    <input name="f_name" type="text" size="40">
    <input name="l_name" type="text" size="40">
    <input type="submit" name="Submit" value="Submit Information">
    </form>
    </body>
    </html>

    --------------------------addleads.php------------------------------------------
    <?

    include("./config.php");

    $sql = "INSERT INTO $table_name
    (leads_id, title, f_name, l_name)
    VALUES
    ('$leads_id', \"$title\", \"$f_name\", \"$l_name\")";

    //debug tool

    print $sql;

    $result = mysql_query($sql, $connection) or
    die ("Couldn't execute query.");

    ?>
    <html>
    <head>
    <title>Untitled</title>

    </style>
    </head>

    <body>
    <? echo $title ?>
    <br>
    <? echo $f_name ?>
    <br>
    <? echo $l_name>

    -----------------------------------------------------------------------------------

    What I am getting this....

    INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ('', "", "", "")

    *Salutation*



    *First Name*



    *Last Name*


    As you can see nothing is being pass...is there some other command
    beside the print $sql statement to see why nothing is being passed.

    Thanks.
    Payne Guest

  2. #2

    Default Re: [PHP] passing form information.

    Hi Payne

    for starters your missing an ? at the last echo
    <? echo $l_name>

    secondly I would rewrite the sql statement to read
    $sql = "INSERT INTO $table_name
    (leads_id, title, f_name, l_name)
    VALUES
    (' ".$leads_id." ', ' ".$title." ', ' ".$f_name." ', ' ".$l_name."
    ');";


    but the statement itself shouldnt cause a problem either way.

    I am wondering where leads_id comes from however.. is it an auto number?


    and finally your processing form is called addlead.php
    and the form is posting to a form called addleads.php

    hope this helps

    chris
    <-- snip -->
    From: "Payne" <com> 
    -------- 
    ------ 
    --------- 
    "") 
    <-- snip -->
    Chris Guest

  3. #3

    Default Re: [PHP] passing form information.

    Payne wrote:

    [big snip]
     

    Is register_globals off?

    - Brad
    Brad Guest

  4. #4

    Default Re: [PHP] passing form information.

    Sorry,

    I am LD. I do have the <? echo ?> in my code. The leads_id is an
    autonumber, it the primary key for the table. What do the .$field. gives
    you over $field?
    Also another LD mistake, addlead.php is addlead.php.

    I will try it.

    Payne

    Chris Sherwood wrote:
     
    >--------
    >

    >------
    >

    >---------
    >

    >"")
    >

    ><-- snip -->
    >
    >
    >
    >[/ref]
    Payne Guest

  5. #5

    Default Re: [PHP] passing form information.

    Brad Pauly wrote:
     
    >
    >
    > Is register_globals off?
    >
    > - Brad
    >[/ref]
    That's in the php.ini right?
    Payne Guest

  6. #6

    Default Re: [PHP] passing form information.

    I tried that and I am still get this.....

    INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ( '', '', '',
    '');

    and empty information is being posted into the database.

    Chuck

    Chris Sherwood wrote:
     
    >--------
    >

    >------
    >

    >---------
    >

    >"")
    >

    ><-- snip -->
    >
    >
    >[/ref]
    Payne Guest

  7. #7

    Default Re: [PHP] passing form information.


    Dont apologize. even the best of us make mistakes.

    the .$field. is a more reliable way of displaying the information contained
    within. as in a few cases I find the variable itself gets printed ie $field
    shows up as $field in cases where I didnt use the .$field. just an
    observation on my part.

    if the form name was a typo then you will want to check your
    register_globals in your php.ini file it probably is turned off
    in which case you want to use
    $l_name = $_POST["l_name"];
    etc..

    this will give you the var values with out having to change your php.ini

    its also more secure if what I read is correct.

    Chris
     [/ref]
    ".$l_name." [/ref]
    Chris Guest

  8. #8

    Default Re: [PHP] passing form information.

    If I use the $l_name = $_POST["l_name"]; am I correct to believe that
    that will go in php area before the sql statement?

    Chris Sherwood wrote:
     [/ref]
    >".$l_name."
    >
    > [/ref]
    >
    >
    >[/ref]
    Payne Guest

  9. #9

    Default Re: [PHP] passing form information.

    --- Payne <com> wrote: 

    [snip]
     

    [snip]
     

    [snip]
     

    This question comes up a few times a week, so you can probably find a lot of
    good information in the archives:

    http://marc.theaimsgroup.com/?l=php-general

    Read here about register_globals:

    http://www.php.net/register_globals

    More important than all of this is the security vulnerability you have created.
    Never, ever, ever use unfiltered data directly in your SQL statement like that.
    Using $_POST['f_name'] instead of $f_name helps you to realize where data is
    coming from, but this does you no good if you just blindly trust what the
    client sends you. Always verify data from the client; you never know what
    they're going to send you.

    Hope that helps.

    Chris

    =====
    My Blog
    http://shiflett.org/
    HTTP Developer's Handbook
    http://httphandbook.org/
    RAMP Training Courses
    http://www.nyphp.org/ramp
    Chris Guest

  10. #10

    Default Re: [PHP] passing form information.


    Payne wrote:
     

    first off i guess this is addlead.php (without the s or your post action is wrong
    above.)
     

    Don't insert data into your auto-increment field. Just use $sql = "INSERT INTO
    $table_name (title, f_name, l_name)
    VALUES ('$title', '$f_name', '$l_name')"; and use ' instead of " to encapsulate
    your variables. If they are not available in PHP after posting use $_POST["varname"]
    instead of $varname. (even in the SQL query if you prefer)

    Justin
     
    J Guest

Similar Threads

  1. passing information between Flash applications
    By RonWheeler in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: February 10th, 01:13 PM
  2. passing password from form to form
    By Hi Ho in forum PHP Development
    Replies: 1
    Last Post: February 5th, 01:03 AM
  3. Passing information between pages
    By Tim Almond in forum ASP.NET Security
    Replies: 1
    Last Post: July 21st, 07:04 AM
  4. passing information from subform to main form?
    By Greg Doudna in forum Microsoft Access
    Replies: 0
    Last Post: July 9th, 04:59 PM
  5. passing arguments from web-form to win-form
    By Mart Rogers in forum ASP.NET Web Services
    Replies: 6
    Last Post: July 9th, 07:18 AM

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
  •