Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Using $_POST on custom pages

Asked Modified Viewed 1,637 times
B
Bill1095
B
  • Newbie, joined since
  • Contributed 7 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
asked
Newbie

I am having trouble using $_POST on custom pages. I have created two test pages and tried using this on page one:

<form action="viewpage.php?page_id=2.php" method="post">
First name: <input type="text" name="firstname" /><br />
Last name: <input type="text" name="lastname" /><br />
<input type="submit" value="Test" />
</form>

Then on page two I have:

<?php   
   echo $_POST['firstname'] . ' ' . $_POST['lastname'];
?>

When I click the submit button, my main page opens up and not the firstname, lastname test page I have created.

Any thoughts?

Thanks!
0 replies

5 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Hi,

Forms will not work in Admin >> Content >>> Custom pages you will need to make an actual page for it in php.

Also make sure you secure that $_POST['firstname'] and $_POST['lastname'] using stripinput.
Like so...

stripinput($_POST['firstname'])
stripinput($_POST['lastname'])
0 replies
B
Bill1095
B
  • Newbie, joined since
  • Contributed 7 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

OK. Thank you.

What would be the best way to create a new file? I defiantly want to keep the panels and such intact. I am not sure what all I would need to include.

Thanks.
0 replies
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
answered
Senior Member

Hey Bill1095,

You can use custom pages. If you wish to read post data from the custom page, change the action url below to the custom page id your using.

In administration > custom pages. Input the following into the Page Content area. Once you edit it to match your content, click save and visit the page.

<?php
if (isset($_POST['submit'])) {
echo "Your action was submitted<br />";
echo "Input was: ".$_POST['name'];
} else {
echo "Input and submit. ;)";
}

echo "<form name='form_name' id='form_id' method='post' action='viewpage.php?page_id=2' enctype='multipart/form-data'>\n";

echo "<input type='text' name='name'>\n";

echo "<input type='submit' name='submit'>\n";

echo "</form>";
?>


Best,
NetriX

Proof of Concept: http://demo.phpfusionmods.com/viewpage.php?page_id=2
Edited by NetriX on 04-06-2011 00:17,
0 replies
B
Bill1095
B
  • Newbie, joined since
  • Contributed 7 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

Thanks NetriX. I think I will make new pages as suggested by Craig. Ultimately, I would like to create an Infusion for what I am doing. Is there a guide or how-to for making Infusions? My php and MySQL skills are up to the task, but I see that a lot of work has gone into php-Fusion. Instead of decoding all of the work done, it would be nice to have a guide to get started.
0 replies
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
answered
Senior Member

Infusion SDK

http://www.php-fusion.co.uk/downloads.php?cat_id=17&download_id=204
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 5 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
N
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
B
B
  • Newbie, joined since
  • Contributed 7 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet