Hi,

Below code is not working. Once I run it, it works fine. i expected "Thanks" but i get nothin. is not redirecting to thankyou.html

<form name="myForm"
action="/send_email4.php" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
Name: <input type="text" name="fname" />
Email: <input type="text" name="email" />
Phone No: <input type="text" name="phone" />
<input type="submit" name="submit" value="submit"/>
</form>

-----
thankyou.html has nothing but Thanks.


-----------------------------------------------
Note: i have another file that redirects to thankyou.html.

Pls advise. thx.

where's your redirect part.. ??
paste that code too..

thankyou.html is the redirect file. it has nothin. only

"Thanks for your submit".

as i said, it works for other file but not for this one.

To redirect the browser, output a "Location: ..." header or its meta-tag equivalent.

I am not riderecting the web site to different url.
I am keep same url. Only when i submit the form, i want to get "thanks.." on the screen.

hey buddy,
well,have u learned php?
your are setting the form action to send_email4.php and expecting the result action to be on thankyou.html.Also u are saying you dont want to redirection ...!!!!
please be clear in your approach to your programming
if you dont no php basics please visit http://www.w3schools.com/php/php_forms.asp and learn how to use forms with php

Scenario1:
a. i have a file named "form1.php"
b. i have 2nd file name "gdform.php"
c. i have another file named thankyou.html


when i run "form1.php", i enter data then hit submit. then i get "Thanks" message.

Scenario2:
i have a file named "form2.php"
i have 2nd file name "send_email4.php"
i have same file named thankyou.html


when i run "form2.php", i enter name/email then hit submit. then i dont get "Thanks" message.

---------------------
details:
scenario1:
form1.php code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Dynamic Version by: Nannette Thacker -->
<!-- http://www.shiningstar.net -->
<!-- Original by : Ronnie T. Moore -->
<!-- Web Site: The JavaScript Source -->
<!-- Use one function for multiple text areas on a page -->
<!-- Limit the number of characters per textarea -->
<!-- Begin
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
// End -->
</script>


</head>

<body>
<A href = "http://crictime.com/">Watch World Cup Cricket 2011 Live</A>
<form name="myForm"
action="gdform.php"
method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />

<BR><b>Submit request to add your business:</b> <script language="JavaScript">document.write(findersHTML('CATEGORY'));</script><br>
<p style="margin-top:10px;">

<div style="float:left;">
<b>First Name</b><br><input type="text" name="FNAME" class="textField1" MAXLENGTH = "15" style="width:200px;"><p style="margin-top:6px;">

<b>Last Name</b><br><input name="LNAME" type="text" class="textField1" MAXLENGTH = "15" style="width:200px;"><p style="margin-top:6px;">

<b>Phone No.</b><br><input name="Phone" type="number" class="textField1" MAXLENGTH = "12" style="width:100px;"><p style="margin-top:6px;">

<b>Email</b><br><input name="EMAIL" type="text" class="textField1" MAXLENGTH = "85" style="width:300px;">
<br /><br><b>Business Type:</b><br><input name="business" type="text" class="textField1" MAXLENGTH = "16" style="width:200px;">
<br />
<b>Business Street Address:</b><br><input name="Address" type="text" class="textField1" MAXLENGTH = "35" style="width:300px;">
<br/><b>Business City:</b><br><input name="Address" type="text" class="textField1" MAXLENGTH = "15" style="width:150px;">
<br/><b>Business State:</b><br><input name="Address" type="text" class="textField1" MAXLENGTH = "15"style="width:90px;">
<br/><b>Business ZipCode:</b><br><input name="Address" type="text" class="textField1" MAXLENGTH = "5" style="width:50px;">

<br><b>Your Message</b><br>
<textarea name="message1" wrap="physical" cols="28" rows="5"
onKeyDown="textCounter(document.myForm.message1,document.myForm.remLen1,225)"
onKeyUp="textCounter(document.myForm.message1,document.myForm.remLen1,225)"></textarea>
<br>
<input readonly type="text" name="remLen1" size="3" maxlength="3" value="225">
characters left
<br>

<input type="Submit" name="Submit" value="Submit">
<br>
</form>


</body>

</html>

------------------
thankyou.html
has nothing but Thanks.

bc i only want to see thanks. it works.

-------------------------------------------------------------------------------------
scenario2:
form2.php:

<form name="myForm"
action="/send_email4.php" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
Name: <input type="text" name="fname" />
Email: <input type="text" name="email" />
Phone No: <input type="text" name="phone" />
<input type="submit" name="submit" value="submit"/>
</form>

same thankyou.html as scenario1.

all the files are under same directory.

I am new to php. To me, if scenario works, why not scenario2?

thanks.

form 1 and form 2 both have same line.

<input type="hidden" name="redirect" value="thankyou.html" />

scenario1 works but not scenario2.

??

hi,
i cant see the code of gdform.php file.
when u submit , the data is sent of gdform.php which processes data further ....
But there is not a single code of PHP in the post you provided.
please post all the codes u have..then i can help u somehow
bye

Hi,

open all the scripts that are the action of the forms and add at the top

<?php header('Location: thankyou.html'); ?>

Hope this works
Calum

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.