Killersites.com Homepage Welcome Guest   |   Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help



Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 26
Posts: 26   Pages: 3   [ 1 2 3 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4628 times and has 25 replies Next Thread
Male kitster79
Member




Joined: Apr 8, 2008
Post Count: 70
Status: Offline
Reply to this Post  Reply with Quote 
Form Successful Submission Message

Hi,

I am trying to figure out how to display a message that indicates that a form has been submitted successfully. I have just one input text field in the top right corner of the page where one can enter their email address to subscribe to a newsletter. Here is the link to the page in progress...

http://www.vojodesign.com/proofs/blockedFunds

As you can see, I have a background image behind the input box. I would like all of this to disappear and be replaced with some text that just says, "Thank you, you have successfully subscribed to our newsletter!"

Can anyone help me code this?

I appreciate your time in advance.

Kit

[Dec 7, 2008 5:52:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

Are you looking for complete PHP code, or just a way to approach it?

Here's one way to approach it...

<?php
if (isset($_GET['success']) == true) {
// show success message here }
else {
// show form here }
?>

Basically, this would check the URL for a success message. If the URL would includes "?success", the success message would be shown. If not, the form would be shown.

For example:

http://www.vojodesign.com/proofs/blockedFunds/ -- doesn't show form
http://www.vojodesign.com/proofs/blockedFunds/?success -- shows form
http://www.vojodesign.com/proofs/blockedFunds/quote.php?success -- shows form

When the form is submitted, it would process the input and then redirect to the same page, with "?success" added to the url.

As I said, just one way to approach it. There may be other methods.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
----------------------------------------
[Edit 1 times, last edit by falkencreative at Dec 8, 2008 2:23:52 AM]
[Dec 7, 2008 6:12:08 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male kitster79
Member




Joined: Apr 8, 2008
Post Count: 70
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

So, would I have to create a version of every page without the form and WITH the success message?
[Dec 7, 2008 9:16:31 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

No, PHP will take care of that for you.

Using (roughly) this snippet:

<?php
if (isset($_GET['success']) == true) {
// show success message here }
else {
// show form here }
?>

The browser will figure out if the URL includes the "success" variable, dynamically include or exclude the form. You will only need one version of the page. However, each page would have to use the .php ending, rather than .html, in order for PHP to work (and of course your server will have to support PHP)
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Dec 7, 2008 9:19:06 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male kitster79
Member




Joined: Apr 8, 2008
Post Count: 70
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

No, PHP will take care of that for you.

Using (roughly) this snippet:

<?php
if (isset($_GET['success']) == true) {
// show success message here }
else {
// show form here }
?>

The browser will figure out if the URL includes the "success" variable, dynamically include or exclude the form. You will only need one version of the page. However, each page would have to use the .php ending, rather than .html, in order for PHP to work (and of course your server will have to support PHP)


But since each of the pages that contain the form element have different content, how will the "success" version of the page hold the same content as before the form was sent?
[Dec 8, 2008 12:25:35 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

But since each of the pages that contain the form element have different content, how will the "success" version of the page hold the same content as before the form was sent?


I'm not totally sure what you are asking. The only bit of content that changes is whether or not the form displays or not. All the remaining content would stay the same. As I said, when the form is submitted, PHP would be used to process the input and then redirect to exactly the same page, with "?success" added to the url. Since "?success" is part of the URL, PHP would be used to show the success message.

A more complete example:

<html>
<head>
</head>
<body>
Content here...

<?php
if (isset($_GET['success']) == true) {
// show success message here
// form will not show }
else {
// success message will not show
// show form here }
?>

Content here...
</body>
</html>
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Dec 8, 2008 1:22:00 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male kitster79
Member




Joined: Apr 8, 2008
Post Count: 70
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

But since each of the pages that contain the form element have different content, how will the "success" version of the page hold the same content as before the form was sent?


I'm not totally sure what you are asking. The only bit of content that changes is whether or not the form displays or not. All the remaining content would stay the same. As I said, when the form is submitted, PHP would be used to process the input and then redirect to exactly the same page, with "?success" added to the url. Since "?success" is part of the URL, PHP would be used to show the success message.

A more complete example:

<html>
<head>
</head>
<body>
Content here...

<?php
if (isset($_GET['success']) == true) {
// show success message here
// form will not show }
else {
// success message will not show
// show form here }
?>

Content here...
</body>
</html>



OK. Thanks Falken. I'll give it a go.

Kit
[Dec 8, 2008 1:43:32 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

OK, I did a bit of experimenting, and this is what I ended up coming up with... Looks like you really don't need the whole "?success" thing. Just work from this code:

<?php

if (isset($_POST['submit'])) {

// process the form input here...
echo "success";
}
else { ?>

<form action="" method="post">
<div>
<input type="text" name="test" value="" id="test"> <input type="submit" value="submit" name="submit">
</div>
</form>

<? } ?>


Basically, the if statement just checks if the form has been submitted. If it has, it processes the input, hides the form and prints the right message. If it hasn't been submitted, the form shows.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Dec 8, 2008 2:20:48 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male kitster79
Member




Joined: Apr 8, 2008
Post Count: 70
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

Falken,

So I plugged the rest of the code into your recommended code. I have probably totally screwed it up though - i'm terrible with this kind of stuff. Could you see if it looks right to you now? I also pasted below my html. Thanks much.

<?php

if (isset($_POST['submit'])) {

$EmailFrom = "contact@blockedfunds.com";
$EmailTo = "kit@vojodesign.com";
$Subject = "BlockedFunds.com - Contact Form Submission";

$Email = Trim(stripslashes($_POST['Email']));

// prepare email body text
$Body .= $Email;


// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

echo "success";
}
else { ?>

<form action="" method="post">
<div>
<input type="text" name="test" value="" id="test"> <input type="submit" value="submit" name="submit">
</div>
</form>

<? } ?>




HTML...

<form action="post" method="../php/newsletterForm.php">
<input id="search_box" onblur="if(this.value==''){this.value='enter your email address...'}" onfocus="this.value=''" title="Enter a keyword and press Enter" value="enter you email address..." size="21" name="s"/>
��������<input name="btnSubscribe" type="button" class="btnSubscribe" id="btnSubscribe" value="Subscribe" />
</form>
[Dec 9, 2008 12:58:31 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Form Successful Submission Message

I'll need to take a look at this in more detail later today... I'm just about to leave for work. A couple comments:

-- You'll need to integrate your form into my PHP code, removing my form and replacing it with yours

-- You'll need to make sure that the names of the form elements match up with the php code. For example, $_POST['email'] is looking for the value of the form element that has the name "email". Same thing with the if statement -- it's looking for a form element with the name of "submit". Currently, neither of your form elements have the name="" property
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Dec 9, 2008 11:51:48 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 26   Pages: 3   [ 1 2 3 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread