Closed Thread Icon

Topic awaiting preservation: Form submission help (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=25159" title="Pages that link to Topic awaiting preservation: Form submission help (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Form submission help <span class="small">(Page 1 of 1)</span>\

 
shay005
Nervous Wreck (II) Inmate

From: Ny
Insane since: Mar 2005

posted posted 03-03-2005 03:42

Okay. So earlier I got help from here to hide/view forms. Since doing this my forms will no longer submit through my php. I cannot find what is stopping the submission but I get an error saying that the server cannot be found. Without the javascript for hiding and viewing the forms it works fine. Here is my code:

<script type="text/javascript">

if (document.all && !document.getElementById)
document.getElementById = function(id)
{
return document.all[id];

}

function hideAll() {
for (formNumber=1; formNumber<=3; formNumber++)
document.getElementById("form"+formNumber).style.display = 'none';
}


function show(formNumber) {
document.getElementById("form"+formNumber).style.display = 'block';
}



</script>
</head>

<body bgcolor="#CCFFCC">


<h1 align="center">Forms</h1>


<p><b>Please Choose a form below</b></p>

<!-- form0 -->
<form>
<select name="frms"

onchange="hideAll();show(this.form.frms.options[this.form.frms.options.selectedIndex].value);">

<option value="1">Select a form</option>
<option value="2">Feedback</option>
<option value="3">Help Request</option>
</select>
</form>



<br />
<!-- Form1 -->
<form name="form1" style="display: none;">
</form>

<!-- form2 -->
<form style="display: none;" action="http://www2.esc.edu/jstoner/form-to-email.php"

name="form2" method="post">
<input type="hidden" name="ToAddress" value="shannonbrossoit@hotmail.com" />
<input type="hidden" name="CCAddress" />
<input type="hidden" name="Subject" value="WSD: Assignment 3.2 - Web Form for Shannon

Brossoit" />
<fieldset>
Email:<br /><input type="text" name="FromAddress" /><br />
Name:<br /><input type="text" name="Name" /><br />
Address:<br /><input type="text" name="Streetaddress" /><br />
Address 2:<br /><input type="text" name="address2" " /><br />
City:<br /><input type="text" name="city" /><br />
State:<br /><input type="text" name="state" /><br />
Zip code:<br /><input type="text" name="zipcode" /><br />
Country:<br /><input type="text" name="Country" /><br />
Rate my site from 1 to 5<br />
1 = :0( <br />
5 = :0) <br />
<input type="radio" name="rating" value="1" />1<br />
<input type="radio" name="rating" value="2" />2<br />
<input type="radio" name="rating" value="3" />3<br />
<input type="radio" name="rating" value="4" />4<br />
<input type="radio" name="rating" value="5" />5<br />
Comments:<br />
<textarea name="Comments" rows="10" cols="25" ></textarea><br />
<input type="submit" value="Submit" style="margin-top: 20px" />
<input type="reset" value="Reset Form" style="margin-top: 20px" />
</fieldset>
</form>


<!-- form3 -->
<form style="display: none;" name="form3"

action="http://www2.esc.edu/jstoner/form-to-email.php" method="post">
<input type="hidden" name="ToAddress" value="shannonbrossoit@hotmail.com">
<input type="hidden" name="CCAddress" />
<input type="hidden" name="Subject" value="WSD: Assignment 3.2 - Web Form for Shannon

Brossoit" style="variable; hidden" />
<fieldset>
Email:<br /><input type="text" name="FromAddress" /><br />
Name:<br /><input type="text" name="Name" /><br />
Address:<br /><input type="text" name="Streetaddress" /><br />
Address 2:<br /><input type="text" name="address2" /><br />
City:<br /><input type="text" name="city" /><br />
State:<br /><input type="text" name="state" /><br />
Zip code:<br /><input type="text" name="zipcode" /><br />
Country:<br /><input type="text" name="Country" /><br />
Phone:<br /><input type="text" name="Number" /><br />
Would you like to be contacted by email or phone?<br />
<input type="checkbox" name="contact" value="email" />Email<br />
<input type="checkbox" name="contact2" value="phone" />Phone<br /><br />
Give a explaination of your problem:<br />
<textarea name="problem" rows="15" cols="30"></textarea><br />
<input type="submit" value="Submit" style="margin-top: 20px" />
<input type="reset" value="Reset Form" style="margin-top: 20px" />
</fieldset>
</form>

<br />

</body>
</html>

Please help!

~Shay

Hugh
Paranoid (IV) Inmate

From: Dublin, Ireland
Insane since: Jul 2000

posted posted 03-03-2005 11:03

It seemed to work perfect here, I copied it into htm file, posted it and got:
PHP Notice: Undefined index: HTTP_REFERER in d:\StudentSites\LocalUser\jstoner\form-to-email.php on line 76
Which was expected, as it should only be able to be run from your server. Or is it that line that doesnt work right, dunno.
I tested out the script too, I flicked between the two forms a few times before posting and tried them both.

Oh , heh check this out found it yesterday
?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
If you add that bit to the end of any php program it displays easter egg style credits.

shay005
Nervous Wreck (II) Inmate

From: Ny
Insane since: Mar 2005

posted posted 03-03-2005 23:50

Well I figured it out. If I stick the page in my main directory instead of a sub directory it works fine. A bit confused on that but at least it works. Thanks for your help.

~Shay

shay005
Nervous Wreck (II) Inmate

From: Ny
Insane since: Mar 2005

posted posted 03-03-2005 23:59

Okay so frustated..it's not sending again all of a sudden and I changed nothing. I guess it's just not my week.

~Shay

Hugh
Paranoid (IV) Inmate

From: Dublin, Ireland
Insane since: Jul 2000

posted posted 03-04-2005 10:37

Got the exact same error so I can't help you anymore. Could you post a link to where you have it hosted? Also, I recon the problem is server side not javascript, that all seems to work fine. Maybe post your script in the server side section and link to this thread.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 03-10-2005 03:46

Just an FYI, I couldn't get the Javascript to work right in Firefox. Choosing the various options in th <select> did nothing.

« BackwardsOnwards »

Show Forum Drop Down Menu