Jump to content

[SOLVED] Forms Variable help


Markx

Recommended Posts

Hi All

 

I'm stuck with a problem.

I've got 3 pages.

 

1) A form which asks for a name of a user.

2) Uses name and then also posts new information from checkboxes to sendmail.php

3) Is sendmail.php

 

The problem is I need sendmail.php to find what name is from the first page. The 1st page uses GET to send the information to 2nd page.

 

sendmail.php contains a lot of

$c18=$_REQUEST['checkbox'];
$c183=$_REQUEST['checkbox2'];
$c19=$_REQUEST['checkbox3'];

etc 

 

but I can't seem to REQUEST the name from the 1st page

 

I hope you can help

 

Thanks

Markx

Link to comment
Share on other sites

you could use sessions to save the info from the first form then recall it at the second from

you could do something like this

//page 2
session_start();
$_SESSION['first_form_data'] = $_REQUEST;

//page 3
session_start();
$username = $_SESSION['first_form_data']['username'];
$name = $_SESSION['first_form_data'][name];

 

Scott.

Link to comment
Share on other sites

It would be best to use a session.

 

page 1 asks user name in a form and sends to page 2.

page 2:

<?php
session_start();
$_SESSION['username'] = $_POST['username'];  //make sure the $_POST username gets sanitized first

 

page 3:

<?php
session_start();
$username = $_SESSION['username'];

 

you must use session_start() on each page (at the top is best) in order for this to work.

 

**EDIT**: ratcatme beat me to it :)

Link to comment
Share on other sites

Hi Both

 

Thank you for that.

It's working great.

 

Next problem...

 

I'm trying to send the information via email using

 

$message = ",$first,$second,$third,$fourth,$fifth,$sixth,$seventh"

mail("mark@ignitiondrivingschool.com","Holiday form", $message );

 

It comes back with

Parse error: syntax error, unexpected T_STRING in /home/ignition/public_html/instructor/sendform.php on line 250

 

I've used echo on all the $first etc and it works fine. The mail command is practically the same as an existing one I use for a completely different form.

 

Any further help would be great  8)

 

Markx

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.