S
S
Svetlana Galenko2018-12-01 17:18:36
Yii
Svetlana Galenko, 2018-12-01 17:18:36

Is it necessary that when you click the buy button, the site immediately opens with the name that the user entered, so that the page itself is created empty?

Good afternoon, I am faced with such a task .. There is an input on the site where the user enters some name, then there is a buy button. After the user has entered his name in the input, he clicks on the buy button, then the user is redirected to the page with the given name, that is, that the page is created automatically with the given name.. (For example: the user wrote the name "namesite" in the input and Accordingly, after pressing the "buy" button, the site opened with the name of my site and after the slash there was a name that the user entered :) http://mysite.ru/namesiteIs it possible to do this? If so, please tell me how to create this procedure, I work with the yii2 framework. Or where to dig at all?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arman, 2018-12-01
@swallow_97

1. It is necessary that this form sends to such an address, because. even the form's get method will be sent to an address like site.ru/?name=namesite
2. As soon as the form can send to mysite.ru/namesite, we make a route so that all records go to which controller + action. Docks by URL
3. in this controller + action we look at what is in the URL and ask the database for records on it, if not, then we create and show it. Google yii+slug

M
morricone85, 2018-12-01
@morricone85

the page will not be created by itself, it is you who want something a lot).
You can see: Form
Controller

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question