954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Can I capture form input text & pass it to the following page

I have a PHP form with a html section at the bottom. There are 14 input text fields on the form and I want the form to send of the email as it should do and also take the name field, pass it to the following web page and display it in a tag.

I think the relevant code looks like this

PHP section

$FName = 'Sub Contractor';
$FWebsiteAfter = 'http://www.website.com/inductionCardSub.html';
$FieldName[0] = 'Your Name';
$Hida2 = trim($_POST['hida2']);


HTML section

<form method="post" action="" enctype="multipart/form-data">
<input type="text" name="FieldData0" value="<? echo $FieldData[0] ?>" maxlength="100" size="30"  /><? echo ' ' . $mmsg[1];
?>
<input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none" />
<input type="submit" class="btn" value="SUBMIT" name="Submit"  />
</form>


Can I capture the input from FieldData0 and send it to the next webpage by Javascript or as a cookie? Or to have then confirm their name in a second form and automatically capture it before the submit button.

I have no script on the following page yet.

Thanks

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Hi,

Javascript itself cannot obtain those value from the user input, and moving it to the next page, unless you prefer saving those data using cookie session. But why do you need JavaScript for this job? Knowing that PHP alone can handle all sorts of data you need from the user w/o using javascript cookie session...

essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

Hi,

I don't have very much PHP experience and a little Javascript learnt about 6 years ago. I was hoping that I could have done it easy with Javascript. I will buy a PHP book today and see if I can work it out from that.


The people who wrote he form don't reply to my requests

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Hi Mel64,

Do you still need a working example of this in Javascript?

essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

Yes please, That would be great.

Regards

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Would this work on the next page

<div>
   <?php
       print ("$FieldData0" );
  ?>
</div>
Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Yes that would work, but if want to capture the exact user inputted entry, then you could try something like:

<?php echo $_POST['FieldData0']; ?>
essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

No it didn't work. I just have a blank area on the following page.

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Hi Mel,
Here's a simple demo:

<form id="testform" action="nextpage.php" method="post">
<div>Test Field: <input type="text" id="FieldData0" name="FieldData0" value="" size="30" /> <input type="submit" value="submit" />
</div>
</form>


on thenextpage.php the code would look something like:

<html>
<head>
<body>
<h1><?php 
$testfield = $_POST['FieldData0'];
   if ( isset( $testfield )) { 
   echo $tesfield;
   } 
else { echo "Failed to capture entries"; } ?></h1>
</body>
</html>
essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

Thanks, that has worked a treat.

Much appreciated.

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

You are welcome...

essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

Again thank you for you help but I didn't realise that when I put the action"" into the form tag, the name field works but the form no longer sent the email and you don't have to fill in the required fields to submit the form. As soon as I take out the action the name doesn't work and the form does.

Any quick thoughts?

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Hi,

I am sorry, but i wont be able to provide you with the exact examples' that involves PHP. This type of data handling, will require some PHP form mailer, which i cannot run here. So i would suggest, that you should try the PHP section, regarding this issue. Im sure those guys from there would be happy to provide you with the exact information that you need on resolving this matter.

But if you still need something with javascript, don't hesitate to post back on us...

-essential

essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

Thank you. for you help. Is there any javascript that will take the value to the next page?

Thanks

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Yes, and that would be the used of cookie session / or a new popup window. Just let me know, If you need some sample code.

essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

Yes I would. the target page will be the mainFrame of a frameset so a popup is out. I was thinking about cookies.

Thanks

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Mistake in line 7.

Should read '$testfield' not '$tesfield'

yeractual
Newbie Poster
1 post since Jul 2009
Reputation Points: 10
Solved Threads: 1
 

Thanks, I picked that on up and it worked well.

The offending code is the form action on the first page.

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

how much data are you trying to pas to the folowing page?
-cause if it's only a Name and/or Surname, you won't be needing 'php', 'cookies' or similar ...

Troy III
Practically a Master Poster
609 posts since Jun 2008
Reputation Points: 120
Solved Threads: 80
 

its only the full name of the user captured in one field. The form as a whole, 14 questions is to be sent to email. The code from the php sample previous listed works well but having a the following page address causes the php form to fail.

Mel64
Newbie Poster
16 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You