html - How to carry href link information forward from page 1 to page 2's PHP form? -


i have number of different pages want lead same form page, carry information page user clicked on form page once form has been filled out.

specifically, want property name carried forward , emailed along other form information.

how information contained in search bar ?property=68yorkville show in email thats sent via php form inbox?

edit:

i realized better if share code directly make things easier:

page 1: http://agentboris.com/listings/test-listing-page.php

page 2 (with form): http://agentboris.com/listings/test-form.php?property=68yorkville701

separate php file form code:

    <?php if(!isset($_post['submit'])) {     //this page should not accessed directly. please use form.     echo "error, please return last page."; } $property = $_get['property']; $name = $_post['name']; $visitor_email = $_post['email']; $tel = $_post['tel']; $message = $_post['message']; $spambot = $_post['spambot'];  if ($spambot != 'yes') {     $spambot = 'no'; }  //validate first if($spambot == 'no') {     echo "please go , check 'i'm not spambot' box.";     exit; }  if(empty($name)||empty($visitor_email)||empty($tel))  {     echo "name, email , phone number mandatory.";     exit; }  if(isinjected($visitor_email)) {     echo "bad email value!";     exit; }     $email_from = "alex@agentboris.com"; $email_subject = "real estate"; $email_body =  "property: $property. \n \n".  "name: $name.\n \n".  "message:\n  $message. \n \n ".   "phone number: $tel.\n \n".  "email: $visitor_email.\n \n".  $to = "alex@agentboris.com"; $headers = "from: $email_from \r\n"; $headers .= "reply-to: $visitor_email \r\n"; //send email! mail($to,$email_subject,$email_body,$headers); //done. redirect thank-you page. header('location: ../contact/thankyou.php');   // function validate against email injection attempts function isinjected($str) {   $injections = array('(\n+)',               '(\r+)',               '(\t+)',               '(%0a+)',               '(%0d+)',               '(%08+)',               '(%09+)'               );   $inject = join('|', $injections);   $inject = "/$inject/i";   if(preg_match($inject,$str))     {     return true;   }   else     {     return false;   } }  ?>  

i not recommend use form data protecting data use server session store form data.

 session_start();  $_session['user_email'] = 'example@mail.com'; 

then, in next page, can read simple variable. (you need start session previously).

you have more (and better) examples here: http://php.net/manual/es/session.examples.basic.php


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -