Question

I want to send complete permalink into database like WordPress when we create a page a new permalink created with id like we create page

Home

it will generate permalink like this http://www.domain.com/project/?p=123

how to do this with custom php

Any help please

Was it helpful?

Solution

html

<form >
<input type="text" method="POST" name="permalink">
<input type="text" method="POST" name="name">
<input type="submit" value="submit">
</form>

php save to db

$permalink = isset($_POST['permalink'])?$_POST['permalink'] : "";
$name = isset($_POST['name'])?$_POST['name'] : "";
$query = "INSERT INTO tablename SET name=".$name.", permalink=".$permalink ;
mysql_query($query);

load from db

http://www.domain.com/project/?p=someWord
$someWord = isset($_POST['someWord'])?$_POST['someWord'] : "";

$query = "select * from tablename where permalink=".$someWord;
mysql_query($query);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top