Forum Moderators: coopster
So how would the following process take place best with php and mysql?
I have a series of form pages containing inputs for collecting information that will be used to build a 'breeder listing' page.
Once the user has filled in each page and submits the third page, he will be sent to a review page showing how his listing page will look except with an 'Upload' button and an 'edit' button, allowing him to review his page.
This will then create a new page.
If I understood how this process is done, I can look up all the details, but I'm confused on the process.
So how would the following process take place best with php and mysql?
If the visitors do have Username and password, let them login and save whatever actions they make into the database. Query the database for simple displaying, query the database to add new rows or update.
If they don't have a username, provide session values, and follow the same process of adding, updating and displaying data from the database.
If this doesn't answer your question, you need to be a little bit more specific of what you exactly need.
Habtom
A form is created and handled in stages. First, it is created. After submission it is re-created with any error messages or sent to the next step of displaying the information then uploading it.
Question:
Do you have a normal html header and put all the php in the body?
good luck
The first function would run writing the first form. A second function would run if a hidden form input in the first form is found in $_POST, checking the inputs of the first form.
Somehow, a third function would re-write a second for, a forth function would check that, and so on until the end where the last function would use the form inputs to build a 'review' page where the user could either go back for corrections or upload the form into a database where it would feed a page.
Is this correct? I've experimented using variables to keep track of what functions has run, but I must misunderstand php variables because it wasn't working...
I'm also missing a number of other design techniques that are hard to figure out by reading php documentation but if I understand the basic mechanisms I could mush more easily know what to look for.
I've only found one good example on onlamp.com It confuses me though. I tryed the code copy / past but I think my local server must have different setting or the code is not complete because it doesn't work like it does on their page.
With sessions would I use multiple pages maintaining inputs within the session?
I wish I had a good example. Learning html, css, and JavaScript is some much easier to find example for - the trouble with them is finding good ones.
1. How do I stop the form process when an error condition is found?
2. What is a good way to arrange things so that error appear under each input?
Here is the code. My current problem is that the page processes before the error displays.
<?php
// Verify something has been inputed
function _input_filled($input)
{
if (strlen(trim($input)) <= 5) return 1;
else return 0;
}
print "<form name='form1' id='form1' enctype='multipart/form-data'
action = 'breeder-list-2.php' method = 'post' />";
print "<input type='text' name='name' size='20' value='' />";
print "<input type='submit' name='submit' value='submit' />";
print "<input type='hidden' name='_submit_check' value='1' />";
print "</form>";
if (array_key_exists('_submit_check',$_POST))
{
if (_input_filled($_POST['name']))
{
print "Input Nam";
}
}
?>