简体   繁体   中英

Simple PHP registration script

I am wanting a really basic script which does the following:

On "index.php" on my home page, i have a basic signup form which has name/email/phone

// index.php

<form action='register/index.php' method='post'>
    <input name='name' type='text'>
</form>

but on my register/index.php page I have a more extended registration page. If someone signs up from the home page, I want it to direct them to the register page, and autofill their details they already put in, to the rego details. Then they can hit 'submit' to complete sign up from the register page (which will go to process.php...).

// register/index.php

<?
    $name=$_POST['name'];
    echo $name;
?>

However this doesn't even do anything? How can I pass variables from one page to another using PHP?

Didn't you missing "submit" button on that form ?

Try adding this :

<input type="submit" value="Submit Form"/>

Inside your form.

Okay. Are you sure you are going to yoursite.com/register/index.php ? Because that code should work. Make sure that you are using colons for all of the script before that in /register/index.php

echo "hello" //WRONG
echo "hello"; //RIGHT

Now, put

error_reporting(E_ALL);

at the very top of your script (just after the <?php initiator) and see if you can fix things from that.

Did you want to know how to pass variables between three or more pages?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM