Sending to two fields with one form

Discussion in 'PHP' started by virtualkev, Jan 2, 2006.

  1. #1
    I need to send some hidden data to a database when a certain part of a form is filed out can this be done if so how.The hidden part will go to a different field on the database.

    Thanks in advance.
     
    virtualkev, Jan 2, 2006 IP
  2. n0other

    n0other Peon

    Messages:
    146
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What is your question? Seems now like you are asking how to retrieve posted data, insert it into the database depending on the conditional statement.
     
    n0other, Jan 2, 2006 IP
  3. jimrthy

    jimrthy Guest

    Messages:
    283
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Are you hand-coding your PHP, or using something like Dreamweaver?

    I remember a friend of mine asking for some help a while back trying to do this (using Dreamweaver). It's another example of why I don't particularly like RADs. After beating our heads against the wall for about a month, I finally found one paragraph in a book that mentioned it can't be done.

    So I hand-coded it for her and sent her the solution. It would have been a lot faster if I'd just done it from the start, but I would have missed out on that delightful learning experience.

    So, does that help?
     
    jimrthy, Jan 2, 2006 IP
  4. virtualkev

    virtualkev Peon

    Messages:
    364
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What i'm trying to do is send a bit of additional data (one word) when a certain part of a form is filled out this extra bit of data will be hidden from the user , this data will be the same for every user and will neesd to be placed in a different place on the database to the data that the user filed out.



    Yes i will be hand-coding.

    It helps a little now i know it can be done, but if you told me how would help a lot
     
    virtualkev, Jan 3, 2006 IP
  5. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <form method="post" action="page_name.php">
    <input type="hidden" name="hidden_text" value="what ever">
    <input type="text" name="full_name">
    <input type="submit" value="Send">

    then
    grab the var
    <?
    $hidden_text = $_POST["hidden_text"];
    $full_name = $_POST["full_name"];


    Then just insert into your database

    "INSERT INTO tablename full_name, hidden_text VALUE ('".$full_name."','".$hidden_text."')";
     
    onlyican.com, Jan 3, 2006 IP
  6. virtualkev

    virtualkev Peon

    Messages:
    364
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks alot that sorted it:D :D :D :D
     
    virtualkev, Jan 4, 2006 IP