View Full Version : Help with simple PHP form

12-23-2006, 09:27 PM
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.

12-24-2006, 12:37 AM
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. :)

12-24-2006, 05:39 AM
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...

12-24-2006, 06:44 AM
Sorry, but that page doesn't show us everything we need to see. The following statement:

<form name="theForm" action="L10FmX.php" METHOD="POST">

says to execute a PHP script named L10FmX.php. We need to see that script.

12-24-2006, 07:17 AM
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.)

12-24-2006, 03:13 PM
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...

<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:

<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:

<script type=TEXT/JAVASCRIPT>
function getTotal(){
var form=document.theForm22;
var inputs=form.getElementsByTagName('input');
var length=inputs.length;
var total='0';

var checked=inputs[i].checked?1:0;
var value=inputs[i].value.split("~~")[0];
document.getElementById('totalspan').innerHTML="System price based on the above configuration (Plus S&H) : $"+total

Thats currently after my </head> as you can see...

Pleeease help. This is really confusing why they both wont work..

12-24-2006, 04:39 PM
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

<form name="theForm" action="L10FmX.php" METHOD="POST" onsubmit="getTotal()">
<input type="hidden" name="required" value="email,realname">
then get rid of this

<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 (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.plugcomputers.com%2Fintelschedule2.php).