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?

Link to comment
Share on other sites

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.

 

 

 

 

Link to comment
Share on other sites

<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>

 

Link to comment
Share on other sites

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;
}
?>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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!!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.