I am beginner php programmer.How can i create dynamic link without using database in php page. For example

I have creat a form. When user enter the data and click submit. I want to display submit page in same page.
My form page is:
www.mysite.com/form.php
and i want to create submit page:
www.mysite.com/form.php?submit

Can anybody please help me with this.

Thanks

Try

header("Location:submit.php");
exit;

Create a if function on submit button... if(submit){}
And then apply header function in last.
For passing values please use Get-post method

all 3 points are very crucial.

<?php
//Check if $_GET['p'] is set if not return empty string
$action = (isset($_GET['p']) === TRUE? strtolower($_GET['p']) : '');

switch($action){
	case 'submit':
		//Accessed as form.php?p=submit
		//Process the form, save to db, etc.
	break;
	default:
		//Accessed as form.php
		//Display the form or show a homepage
	break;
}

Set your form action to www.mysite.com/form.php?p=submit.
You can add additional case statements to cover additional scenarios. This is the easiest way to do this. You can probably find information on this forum for doing dynamic includes as well.

The other way you can do this is like such:

<?php
//User has submitted the form 
//Process the submission
if( isset($_POST) === TRUE ){
	//Process your form post data
	//Save to database, file etc.

        echo 'Form Saved';
        return;
} 

//User is just viewing the page
//Show them the form

In this scenario the form posts its data to itself, where it is then processed and saved. Instead of "return;" in the IF statement you could also redirect the user elsewhere.

Create a if function on submit button... if(submit){}
And then apply header function in last.
For passing values please use Get-post method

yes correct..

it should be something like this
assuming the name of submit button as "submit"

<form action="form.php" method="POST">
<input type="text" name="uid"/>
<input type="password" name="pass"/>
<input type="submit" name="submit"/>
</form>
<?php
if(isset($_POST['submit']))
{
 validate your inputs here...
 header("Location:submit.php");
 exit;
}
?>

Thanks guys for the help. Now, just one more question. How can i create dynamic link using one singe page and not using database.
For example:
I have got 3 page.
index.php now what i want to do is want to create contact and guest book in a same page.

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.