Consulting

Results 1 to 13 of 13

Thread: Solved: PHP help please

  1. #1
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location

    Solved: PHP help please

    Hi,

    Can anyone please explain what is wrong with this code. Yea, its a silly simple example I need to understand before I move on to the more complicated stuff. Thanks

    [vba]<html><body bgcolor="#ffffff">
    <h4>Tizag Art Supply Order Form</h4>
    <form action="process.php" method="post">
    <select name="item">
    <option>Paint</option>
    <option>Brushes</option>
    <option>Erasers</option>
    </select>
    Quantity: <input name="quantity" type="text" />
    <input type="submit" />
    </form>

    <?php
    $quantity = $_POST['quantity'];
    $item = $_POST['item'];
    echo "You ordered ". $quantity . " " . $item . ".<br />";
    echo "Thank you for ordering from Tizag Art Supplies!";
    ?>

    </body></html>[/vba]

    I know its in the form action part but thats what I can't figure out.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    It is simply sending the results of the filled out form to the process.php to be processed. Your process.php will take the info and post it to a file, email it, etc. If you dowloaded the example somewhere you should have the process.php with it....since you say your just starting I assume you won't try to write it yourself.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    The problem is that I have another form that I have modified and written myself that I cannot get to work. I thought if I started small and simple I coul understand it easier. It's not that I don't want to try myself, it the understanding of getting it to work in it's most simplified version. I'm attaching a zip file of what I came up with on my project that wont work. Perhaps if you are still interested, you might have a look.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Hi Austenr,
    I opened the form.html and looked at the form...it's action is:
    [VBA] <form method="POST" action="postit.php">[/VBA]
    so it's trying to send the info to the postit.php....where did you get process.php? Maybe you need to either change it in the code back to postit.php or change the name of the postit.php to process.php.

    I don't have apache installed on my computer at present so I can't test this for you but it looks like the postit.php processes your data and uses sql to update the tes.mdb just as it is set up now...??

    I think you just have a name conflict....change one or the other to match.
    best I can see from here.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Think you have the two mixed up. The first post was a silly test I used off of the internet as a learning tool. In the zip file, the file names are form, postit, and the db called test. Im not sure why it isnt working either. Someone on another board helped me with another problem. The script I sent him was identical to what I had. The code worked on his PC but not on mine. I just installed today, IIS on my work windows 2k machine and am pretty sure I got it configured correctly. Not sure why it runs on others machines and not on mine. If you get near a machine you can test it on that would be good.

    Something else that has me stumped is that on my ISP server which runs PHP, when I hit the SUBMIT button on the form the browser populates with the code from postit and nothing else.

    Thanks

  6. #6
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Can't seem to get PHP configured in Vista. Anyone tell me how to do that? Thanks I have the apache server up and running.

  7. #7
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Ok. I got most of my prblems ironed out. I finally got Apache and PHP on my home machine. The problem lies in the postit.php file in the .zip file above. Here is what is happening. When I press the Submit button on the form, the screen populates with the PHP code from postit.php instead of writing it to the access table. Can anyone that knows PHP take a look and let me know where my error is. This is a work assignment that is due next week. Thanks.

  8. #8
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    That's a sign of an error ok...are you sure the test.mdb is in the same direcory? It appears to be looking for the BMCactive table in the test.mdb using sql connect.

    Have you tested a simple hello world php script or something to assure yourself that php is installed an the path is correct?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  9. #9
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Hi Steve,

    Yes Hello World" works just fine. So if I understand correctly, it is this path:

    [VBA]$conn = odbc_connect('Driver={Microsoft Access Driver (*.mdb)};
    DBQ=C:\Users\Austen & Mary's Comp\Desktop\test','','');[/VBA]

    That is my problem? All three of the files are on the desktop. Thanks

  10. #10
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I may be wrong austenr but I think you need all of these files below your apache directory....in a sub directory....there should be a users/ there or home...where the server resides.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  11. #11
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    If you were testing files in apache, what would your file path look like? Sorry, really struggling with this one.

  12. #12
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    you should look for a folder like apache\web\users or something like that in the apache installation directory.

    attached is a file you can run to see if php is actually working

    just type the path into your web browser address bar something like:
    http://www.yourwebserver.com/phpinfo.php

    if you can't get it to work then you aren't below php and apache in the file tree....or php isn't configured or installed...If it runs you will get a web page created on the fly by the php script that lists all of your php info...version...paths..etc.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  13. #13
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    No definatly did nt work. If I test port 80 in the command prompt I get this message:

    Your port 80 is actually used by:

    Server Apache/2.2.4, PHP/5.2.2.

    The title in the bar is c:\wamp\php\php.exe

    I installed apache from this link:

    http://www.wampserver.com/en/

    It was self installing so I figured it was installed/configured correctly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •