Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with simple PHP form

    Hello all.

    I have recently changed some stuff around on my website and now my form email script is not working on the page...heres my situation:

    On my website Plug Computers we have custom build configuration pages (for example: http://www.plugcomputers.com/intelschedule2.php

    The way the forms results have been done in the past is with a email script where I get the form results in my email. This has worked well, but now it is not working.

    I recently added a new script to the page in order to assign dollar values to each of the computer parts via javascript. You can see at the bottom of the page the price is updated depending upon what computer components are selected. Since adding this my script that emails my form results does not work. When you click the submit button on the bottom of the page nothing happens.

    Could you please take a look at my source on http://www.plugcomputers.com/intelschedule2.php and tell me what is going on and why are these 2 functions conflicting...

    Thanks alot.
    Plug Computers - Custom Intel and AMD Gaming Computers - Visit Today!

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,073
    Thanks
    2
    Thanked 22 Times in 22 Posts
    The link you gave us points to the rendered page, but we need to see the source code for the page.

    Also, when you say your form email script isn't working, what exactly does that mean? It doesn't send email? It comes back with a blank page? Something else? A few additional details would be nice.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can just click on that link and right click and goto show source, it shows everything. Thats the page i'm having troubles with.

    When I say it isnt working I mean that when you click the submit button it doesnt do anything. You just click it and the page does nothing. It doesnt goto a blank page, i dont receive an email. You click the link and it doesnt do anything. I thought i may have the target setup wrong, but that seemed right.

    Just check the source code and see if i'm missing something simple...
    Plug Computers - Custom Intel and AMD Gaming Computers - Visit Today!

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,073
    Thanks
    2
    Thanked 22 Times in 22 Posts
    Sorry, but that page doesn't show us everything we need to see. The following statement:

    Code:
    <form name="theForm" action="L10FmX.php" METHOD="POST">
    says to execute a PHP script named L10FmX.php. We need to see that script.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    There are two opening <form... tags and the first one encountered is what gets used (the second one... is just content within the first form...) and since it does not have an action = "..." parameter, the target URL is the same page. So, it is probably submitting to it self (if it is submitting at all.)
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #6
    New Coder
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    vinyl-junkie..i think CFMaBiSmAd is right, i tried a few things, but am still having issues. This is what the code looked like before...
    Code:
    <form name="theForm22" onclick="getTotal() ">
    
    <form name="theForm" action="L10FmX.php" METHOD="POST">
    <input type="hidden" name="required" value="email,realname">

    I tried flipping the placement of the 2 <form tags so that it would execute the L10FmX.php first:
    Code:
    <form name="theForm" action="L10FmX.php" METHOD="POST">
    <input type="hidden" name="required" value="email,realname">
    		
    <form name="theForm22" onclick="getTotal() ">
    Now after doing this it DOES submit and will send the emails like its supposed to, but now the price calculator (theForm22) will not work. Any way to make both of these work?

    Here is the code for the price calculator:
    Code:
    <script type=TEXT/JAVASCRIPT>
    function getTotal(){
    var form=document.theForm22;
    var inputs=form.getElementsByTagName('input');
    var length=inputs.length;
    var total='0';
    
    for(i=0;i<length-1;i++){
      if(inputs[i].type=='radio'){
      var checked=inputs[i].checked?1:0;
        if(checked){
        var value=inputs[i].value.split("~~")[0];
        total-=-value;
        }
      }
    }
    document.getElementById('totalspan').innerHTML="System price based on the above configuration (Plus S&H) : $"+total
    total='0';
    }
    </script>
    Thats currently after my </head> as you can see...

    Pleeease help. This is really confusing why they both wont work..
    Last edited by PlugComputers; 12-24-2006 at 02:17 PM.
    Plug Computers - Custom Intel and AMD Gaming Computers - Visit Today!

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You really shouldn't be doing the price calculations on the clientside as users can fake it or js can be disabled. Either way you would need to do something like this
    Code:
    <form name="theForm" action="L10FmX.php" METHOD="POST" onsubmit="getTotal()">
    <input type="hidden" name="required" value="email,realname">
    then get rid of this
    Code:
    <form name="theForm22" onclick="getTotal() ">
    I guess you didn't read the part about the 2nd form tag not even going to work since it was just content of the first form tag. Also having 556 coding errors doesn't help either. See them here.
    Last edited by _Aerospace_Eng_; 12-24-2006 at 03:45 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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