I am a new student to php and I am working on my first project. I have created an html form, a php output form and a php confirm form. I am having trouble linking them together, when I fill in the information on my form it does not show up in the output form or confirm form.. Any tips or suggestions on what I should do or check?

Thanks,

Joe

Dani AI

Generated

A quick, practical addendum to the replies from , and — common causes and fast checks when form values vanish between pages, plus a safe way to carry data across a confirm/output flow.

  • Verify the basics first: every input intended to be submitted must have a non-empty name attribute; the form method (POST/GET) must match how the server reads the data; the action must point to the correct handler (relative vs absolute path).
  • Confirm PHP is actually being executed (not opening files via file://). A simple way is to request a tiny PHP page that prints something or phpinfo() from the web server.
  • Inspect what the server receives: add a short debug at the top of the handler to dump incoming values and stop execution. This shows whether data left the browser and arrived at the script.
<?php
// debug at top of handler
var_dump($_REQUEST);
exit;
?>

For multi-step flows (HTML form -> confirm -> output) use server-side persistence instead of relying on re-posting hidden fields every step. Sessions are straightforward and avoid missing/forgotten hidden inputs:

<?php
// save.php (receives form)
session_start();
$_SESSION['form'] = [
  'name'  => trim($_POST['name'] ?? ''),
  'email' => filter_var($_POST['email'] ?? '', FILTER_SANITIZE_EMAIL)
];
header('Location: confirm.php');
exit;
?>

In confirm.php read $_SESSION['form'], validate/sanitize before displaying, then clear the session entry after final processing.

Extra notes: enable error display or check webserver/PHP logs while debugging; validate and sanitize all inputs (use filter_var() and htmlspecialchars() when rendering); ensure a real submit button (type="submit") and that no JS intercepts the submit. This builds on 's pointer about input names and avoids the common local-server problem mentioned by .

Recommended Answers

All 4 Replies

I am a new student to php and I am working on my first project. I have created an html form, a php output form and a php confirm form. I am having trouble linking them together, when I fill in the information on my form it does not show up in the output form or confirm form.. Any tips or suggestions on what I should do or check?

Thanks,

Joe

Give some code dear, so we can tell where the problem exactly lies instead of firing the dart in the dark :)

<--- runs looking for those night vision goggles ;)

Your basic HTML form is going to have the following:

my example is a quick & dirty login script

Page1.html

<form method=POST action=login.php>
<input type=text name=user_id>
<input type=password name=user_pass>
<input type=submit value=Login>
</form>

Your next page (login.php) will need have the following attributes.
You have 2 variables submitted from the form on the previous page. The variables are $user_id & $user_pass.

Your PHP script now needs to do something with these variables. You can compare the username and password to something stored in your PHP file. (not very secure), or later once you are working with a MySQL database, you can locate the corresponding user's information, and either accept the users login, and redirect them to a members page, or deny the login, and print an error.

In short, your HTML form is going to send variables to the PHP script. When you declare a "name=" on an input field, that variable is sent to the next page with that variable name. Then you have to do something with it. Print it out, manipulate the database with it, etc.

Let me do a little more simple example so you can see just what I mean.

This example will just print out some of the information that a user submits, and nothing else.

<form method=POST action=page.php>
Enter your first name: <input type=text name=first_name><br />
Enter your last name: <input type=text name=last_name><br />
Enter your email address: <input type=text name=email_address><br />
<input type=submit value=Login>
</form>

Now, my next page is going to use the information they submitted, and print it back on the screen.

confirm.php

// Since we aren't doing anything fancy, the only PHP function
// I'm using here is echo
echo "
Hello, $first_name $last_name, 
Thanks for signing up for our newsletter. 
I show that your email address is $email_address. 
We will be sending your the first copy soon!!! Thanks!
";

Note:

Your variables that you've submitted from the HTML form appear simply as $first_name, $last_name, and $email_address. This method of retrieving the variables is not secure.

Someone could type in

well you get the idea. This can cause problems if you are sending hidden variables to the next page like a user_id, etc.

To avoid this, and the newly adopted way to call varaibles is via an array created by the PHP server automatically.

The same variables above can be obtained by using
$_POST[first_name], $_POST[last_name], and $_POST[email_address].

this guarantees that the values for these items was only submitted to the script using the POST method. If you are taking classes, or reading up to date info, they should ONLY recommend using this option. I learned on the standard variable and have had to switch over to adopt the newer, safer way of retrieving these variables.

Hope this helps a bit, or might point you in the right direction. :)

I am a new student to php and I am working on my first project. I have created an html form, a php output form and a php confirm form. I am having trouble linking them together, when I fill in the information on my form it does not show up in the output form or confirm form.. Any tips or suggestions on what I should do or check?

Thanks,

Joe

I am also having the same problem PHP is not working in my system is there any one who can solve my problem .

go to w3schools.com , this will help you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.