Jump to content

session variable help please!


Downpour

Recommended Posts

Something like this would go before the form:

 

session_start();

$_Session['formread'] = 0;

 

Then, after the from has been submitted, change the session variable, like:

$_Session['formread'] = 1;

 

Then, you can have an if statement to do display the download page IF the user has submitted the form.

if ($_Session['formread'] = 1)

{

//display download page Or redirect header to download page

}

 

Does this help?

I'm sorry I'm a real newbie at this.  I've never worked with sessions before!!

 

How do I check if submit was entered? Right now I have formail, so when they click submit and enter the information it brings them to my download page.  But if I place the page directly in the url, I can go straight to the page.

 

 

 

 

<form method="post" action="phorme.php" name="SampleForm">

    <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">

<input type="hidden" name="recipients" value="myemail" />

<input type="hidden" name="required" value="email:Your email address,realname:Your name" />

<input type="hidden" name="subject" value="Subcription" />

<input type="hidden" name="good_url"    value="http://mywebsite/download.html" />

 

 

 

<input name="realname" type="text" size="12" ></p>

<input name="email" type="text" size="12"></p>

       

          <input name="Submit" type="image" src="index_files/Squeeze2_27.jpg" border="0" alt="" width="148" height="40" value="Submit"/></td>

 

</form>

 

On your download page, you can add this to the top.  Change the yourform.php to your actual form page or where you want them to go if they try to go directly to it.

 

<?php

if(!isset($_POST['Submit'])) {
   Header ("Location: yourform.php");
   exit;
}
?>

No I didn't close my browser!  Should I have?

 

this is how I have it:

 

<?php

 

if(!isset($_POST['Submit'])) {

  Header ("Location: index.php");

  exit;

}

?>

<html>

 

<head>

<title>Inside the Minds of Winners -- Successful People Really Are Luckier!</title>

<meta name="MSSmartTagsPreventParsing" content="TRUE">

</head>

A html page can't parse PHP (well not without telling your webserver to).  Your form points to phorme.php after it's processed.  So what does that page do?

 

 

 

The phorme.php is the formail.php  It sends the info of the form to me in an e-mail!

 

I also tried putting phorme.php in the location but it didn't work either!!

Rename download.html to download.php

 

Change

 

<input type="hidden" name="good_url"    value="mywebsite/download.html" />

 

to

 

<input type="hidden" name="good_url"    value="mywebsite/download.php" />

 

Add the code from page 1 to your download.php page (if you didn't already).

 

If that doesn't work, you'll have to incorporate sessions.

Archived

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

×
×
  • Create New...

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.