1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

2 Php Form Questions

Discussion in 'PHP' started by trenttdogg, Feb 12, 2013.

  1. #1
    1) Is it possible to have 1 php form that both inserts data into mysql and also uploads the actual files(pdf,jpeg) to the server?
    2) Can there be a drop down select box in the form that is tied to the navigation of the site. Basically allowing me to select(rather than manually type) the data?

    I am a total newbie to PHP and MYSQL.
    Thanks.
    SEMrush
     
    trenttdogg, Feb 12, 2013 IP
    SEMrush
  2. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #2
    1. Yes

    2. Yes (would need to be database driven though)

    You can use the same page to insert the data into the database by using SERVER_SELF or simply # in the post action. Once the user hits submit you have your functions, first save the files then insert to the database.

    I'm guessing currently you are posting to a separate file something like user is on account/upload.php and it posts to account/uploaded.php

    Simply use the method above to do it on the same page and check if the user has submitted the form using something like:

    <?php
    if(isset($_POST['Submit']))  {
     
    // Add images
     
    // Insert into the database
     
    // Output success message
    }
    ?>
    // Show the page
    Code (markup):
     
    scottlpool2003, Feb 13, 2013 IP
  3. iitstudent

    iitstudent Banned

    Messages:
    43
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    23
    #3
    Yes you can upload and insert data together in the same form by simple using one page form or can make another page specified in the action.

    You can tie url as a value in the dropdown list and add ajax to it so it can be viewed or redirected according to the value selected from the dropdown list
     
    iitstudent, Feb 13, 2013 IP