Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 08-19-2012, 05:13 PM
Member
Latest Blog:
None

 
Join Date: 09-30-11
Posts: 34
iTrader: 0 / 0%
Pass variables from form to thanks page - booking calendar

I am using the wp booking calendar pro 9.0 plugin. So you choose dates on a calendar, fill out a form, then it takes you to your thank you page. So I want to use something like <?php echo $name; ?> to put the form data on my thank you page but it does not work.

Here is a quick sample page if you care to have a look:
virtualgeorge.info/book/calendar

Not exactly sure how the ajax form in the plugin works so I just used firebug to see the field names and
added <?php echo $name14; ?> & <?php echo $secondname14; ?> to the thanks page thinking that would display the first & last names?

Do I need anything like:
<?php
$name14 = $_POST["name14"];
?>

on the thanks page?

thx!
 
Reply With Quote
  #2 (permalink)  
Old 08-21-2012, 03:55 AM
Super Moderator
Latest Blog:
None

 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 1,854
iTrader: 0 / 0%
Here is an example of how to receive posted form data, and converting it to xhtml before the data is send to the web browser:
PHP Code:
<?php
//check if variable is set
if(isset($_POST["name14"]))
{
    
//add post value to variable
    
$name14 $_POST["name14"];
    echo 
changePostValueToXHTML($name14);
}


function 
changePostValueToXHTML($postValue)
{
    
//if get_magic_quotes_gpc() is on then slashes is added to special characters like single and double quotes
    //that is good if the data need to be inserted to a database, but doesn't look good if you just want to display
    //the variable value on a web page.
    
if(get_magic_quotes_gpc())
    {
        
$postValue stripslashes($postValue);
    }
    
    
//convert string to xhtml, so you can echo it to the client web browser, without risking 
    //that somebody adds xhtml markup in the form and it get rendered on the thank you page as xhtml markup(for security and valid markup)
    //I have have asumed that you use XHTML and characterset is set to UTF-8,
    //if that's not the case, then take a look at:
    //http://www.php.net/manual/en/function.htmlspecialchars.php
    
$postValue htmlspecialchars($postValueENT_QUOTES ENT_XHTML'UTF-8');
    
    return 
$postValue;
}



?>
__________________
Need a break? EnterCave more than 40000 online games in 15 categories.
Search or browse through EnterCave Online Games Directory
 
Reply With Quote
  #3 (permalink)  
Old 08-21-2012, 02:01 PM
Member
Latest Blog:
None

 
Join Date: 09-30-11
Posts: 34
iTrader: 0 / 0%
I am not sure where to add that code? I tried the thank you / results page but that didn't work.

I have done similar things with more simple forms but have a form page, then a processor.php but this plugin has one long page for the form that is over 3000 lines long so not sure how to go about this.

Any other tips or should I just go hire someone and save some time
 
Reply With Quote
  #4 (permalink)  
Old 08-22-2012, 02:07 AM
Super Moderator
Latest Blog:
None

 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 1,854
iTrader: 0 / 0%
I tested the code before i posted it on v7n, so if the code is on the page where the form is posted to, and the form have a text input with the name name14, then the code should work.

Maybe you can post an url to the page with the form?
__________________
Need a break? EnterCave more than 40000 online games in 15 categories.
Search or browse through EnterCave Online Games Directory
 
Reply With Quote
  #5 (permalink)  
Old 08-22-2012, 02:39 AM
Member
Latest Blog:
None

 
Join Date: 09-30-11
Posts: 34
iTrader: 0 / 0%
Thanks for the help!
I posted the link to the form in the OP
virtualgeorge.info/book/calendar
 
Reply With Quote
  #6 (permalink)  
Old 08-22-2012, 12:57 PM
Super Moderator
Latest Blog:
None

 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 1,854
iTrader: 0 / 0%
Ok, made a few changes, so now the markup is handled as html5, and text input for first name was named name18, and not name14(i think i got that from your post). Anyway, i hope this code work:
PHP Code:
<?php
//check if variable is set
if(isset($_POST["name18"]))
{
    
//add post value to variable
    
$name18 $_POST["name18"];
    echo 
changePostValueToXHTML($name18);
}


function 
changePostValueToXHTML($postValue)
{
    
//if get_magic_quotes_gpc() is on then slashes is added to special characters like single and double quotes
    //that is good if the data need to be inserted to a database, but doesn't look good if you just want to display
    //the variable value on a web page.
    
if(get_magic_quotes_gpc())
    {
        
$postValue stripslashes($postValue);
    }
    
    
$postValue htmlspecialchars($postValueENT_QUOTES ENT_HTML5'UTF-8');
    
    return 
$postValue;
}



?>
__________________
Need a break? EnterCave more than 40000 online games in 15 categories.
Search or browse through EnterCave Online Games Directory
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
form to pick a calendar day? spacefem Coding Forum 4 03-20-2012 01:58 PM
php: long variables with other variables which needs to be sent by email imadam Coding Forum 1 09-27-2011 06:14 PM
How to populate javascript variables with form data? toasty525 Coding Forum 1 02-23-2011 10:27 PM
Selling Links that Pass Page Rank tdd1984 SEO Forum 2 12-03-2007 09:24 AM
Does Page Rank Pass Through a Question Mark? theChronic SEO Forum 1 12-01-2006 04:45 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:50 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.