Jump to content

Archived

This topic is now archived and is closed to further replies.

wizzkid

Contact Forms Reciept

Recommended Posts

Hi Guys,

I made a contact form that actually the value to the specified email address. What it does is let the user verify the detail entered and send to the email and have a reciept. My problem lies on the reciept.

Here's my pages http://www.leeph.net/pastebin/test/

Everything is working.
contacts.php
verify.php
mailman.php reciept.php
note: on verify.php action=mailman.php and redirect = reciept.php

What I want to do is display:
Thank you NAME, we will respond you at EMAIL.

What I did is on reciept.php, i put:
[code]<?
print "Thank you".$_POST['fname']."<br>;"
?>[/code]

I am not sure if its the correct syntax. I used the $_POST['fname'] on verify.php and it worked.

Should you need some clarification about this setup. let me know.

hoping a response to this matter.

Thanks.

Share this post


Link to post
Share on other sites
put the fname in a seesion then print user name ok.

Share this post


Link to post
Share on other sites
how can i declare session? can you point me where to get docs and how to do it? sorry im newbie :)

Share this post


Link to post
Share on other sites
actually what your doing is just fine, good job.

now if you are going to use the persons name as they browse around the site then you could put the name into a session.

this site has a good tutorial on sessions but for the short version, a session is just a cookie on the server (not the client) computer and you create it like this

session_start();
$_SESSION['name'] = $_POST['fname'];

now later on when you want to use that name again just call $_SESSION['name']

like this

echo "Hello " . $_SESSION['name']

just be sure to put session_start() at the top or before any output is sent to the browser of all your pages to keep it alive

Share this post


Link to post
Share on other sites
test.php
<? session_start();

// set the session session_start(); on all pages to return data and no html can go before it.

$fname="john";
$username=$_SESSION[''username']=$fname;

//username is the varable for the session.

// $_SESSION['username'] is the session that gets and holds the users name

//$fname was the name of the user

echo"<a href='test_result.php'>go and see the name of the user</a":
// echo a link to see the next page.
?>

test_result.php
<? session_start();

// set the session_start() agin

echo $username;
// echo the varable that was set via the session.
?>

link to session information ok.
http://uk.php.net/session

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.