Store data from two forms - html

I have two html pages for registration, first contains Personal Details and second contains contact details. I need to get data from first and second page and store it in database.
app.py - https://pastebin.com/d9Jbx9VL
preg1 - https://pastebin.com/qcPpUN5s
preg2 - https://pastebin.com/Kppcr8sN
The methods to check in app.py are /p_reg1 and /p_reg2
After clicking the 'Next' button in first page,the data is shown in the address bar. But after submitting it in the second page, data from first page is inserted as 'NONE' to database.
https://i.imgur.com/FFJDOPV.jpg

you taged sql.
sql solution is :
you should create a view in database for inner join between Personal Details and contact details by Common ID.
for example :
create view vw_myview
select p.name, p.f_name, c.phone_num1, c.phone_num2
from Personal p inner join contact c on contact.id=Personal.id
Other methods are also available.
Explain more.

Related

How do I insert data from a reference table to the corresponding field

I'm sorry if my question sounds confusing.I just started learning web2py recently,in this exercise I'm trying to make a simple users management webpage with the admin can assign the users theirs work lists,note and deadline
db.define_table('auth_manager',Field('name','string',requires=IS_NOT_EMPTY()))
db.define_table('manager',Field('user','string','reference user.name'),
Field('workname','text',requires=IS_NOT_EMPTY()),
Field('deadline','date'),)
db.manager.deadline.requires=IS_DATE_IN_RANGE(format=T('%Y-%m-%d'),
minimum=now,maximum=now+datetime.timedelta(60))
I thought of adding the manager's username in auth_manager table using appadmin's new record function.This is my user table
db.define_table('user',Field('name','string',requires=IS_NOT_EMPTY()),
Field('password','password'),
Field('workname','text'),
Field('deadline','date'),
format='%(name)s')
I wanted to insert workname and deadline into user table right after I add those form on manager but I couldn't find any other methods except the update or update_or_insert functions but both don't work because those fields can't be empty and their ids aren't the same value and multiple references to a single table don't work .
One last question,I want to use web2py's RBAC but the first & last name fields are often unnecessary if I want to use a full name field is there other way to do it?
Sorry for the long post,I hope I made my question clear.
You can use the tables from auth and let web2py to handle everything in between.
The following code should resolve your problem:
db.define_table('manager', 'reference auth_user'),
Field('workname', 'text', requires=IS_NOT_EMPTY()),
Field('deadline', 'date'))

Need to identify dynamic text value in selenium python

I am new to selenium webdriver python . I need to automate back end process of an e-commerce application ( order processing)
here the orders are classified to three types :
say A-type , B-type and C-type .
After successful order completion the orders will listed in an interface .
In all listed orders, its order type will mentioned like
"ORDER TYPE:A-type"
According to these three types certain scenarios will be executed. I need to identify this type. In a page there may be more than one A-type/B-type/C-type orders.
here the orders will be listing one by one will all user details along with order type. please help in this.
its html tag details:
order Type: A-type

Form Opens blank in form view

I have a database system that logs calls for a department. All the calls for today are displayed on a main form in a list box. When a record is double clicked the call can be opened to view the information. This information is stored across two tables by a intermediate relationship.
When the form is opened in design view all the controls are visible. As soon as it goes to form view or a record is attempted to be opened, the form opens blank.
This has happened since i added the information from the second table. What has gone wrong?
Here is the query.
SELECT
TBL_CallsDB.ID, TBL_CallsDB.Agent_No, TBL_CallsDB.Agent_Name,
TBL_CallsDB.Call_Date, TBL_CallsDB.Call_Time, TBL_CallsDB.Caller_Type,
TBL_CallsDB.Call_Type, TBL_CallsDB.[Company Name], TBL_CallsDB.[Company Contact],
TBL_CallsDB.Caller_Name, TBL_CallsDB.Phone_No, TBL_CallsDB.Cell_No,
TBL_CallsDB.Fax_No, TBL_CallsDB.Email_Address, TBL_CallsDB.Address,
TBL_CallsDB.City, TBL_CallsDB.State, TBL_CallsDB.[Zip Code],
TBL_CallsDB.Details, TBL_CallsDB.Action_Resolve, TBL_CallsDB.Resolve_Date,
TBL_CallsDB.Resolved, TBL_CallsDB.Attachments, TBL_CallsDB.Status,
TBL_CallsDB.Memo, TBL_Units.Technology, TBL_Units.[Serial_No#],
TBL_Units.Model, TBL_Units.[Model_No#], TBL_Units.Unit_Type,
TBL_Units.Install_Date
FROM TBL_CallsDB
INNER JOIN TBL_Units ON TBL_CallsDB.Agent_No=TBL_Units.[Agent No];
Examine the values stored in TBL_CallsDB.Agent_No and TBL_Units.[Agent No]. The query's join condition causes it to retrieve only those rows with matching values in Agent_No and [Agent No]. But none of those existing values match, so the query returns no rows.

Retrieving id from database displayed and passing onto other page

I'm displaying the contents of a database on a particular page(recipe names).
I'd like each recipe to be a link which opens to another page. I understand I would have to obtain the recipe id for that particular recipe, pass the id to another page and print the recipe contents onto that page. I would like to know how to retrieve the unique recipe id of a particular recipe ON BEING CLICKED upon mainly.
If you are displaying the contents of a database on a particular page, then definitely you are using a server side scripting like like ASP or PHP or some JavaScript + AJAX. I am quite unclear about that. But for your question, I can tell you one thing that, if, suppose you are using PHP, then you may display the link as;
echo ''.$recipiename.'';
where $recipeid is the variable carrying recipe id and $recipiename is the name of your recipe. In your PHP file (yourpage.php), you may catch this data like $_GET["recipeid"]
You may try a Google search for tutorials.
Use;
$strLink = ''.$strName.'';
echo "<li>".$strLink."</li>";
Don't use spaces.
You just make the id part auf the URL the recipe link points to.
Iced Water
Would be a link pointing to the recipe with ID 23. Since the url is available on the server side you are all set.

Designing Database

I need to design database with frontend as HTML.
This is my first attempt to do this.
What I need is,
- User can input a word from HTML page, click submit
I will query the word to get a URL from database and user sees that webpage(pointed by URL).
Just enter word, submit and get the webpage displayed.
People suggested using JSP/Access. I am new to everything.
Can you please point out what exactly I need to do?
Thanks a ton.
Following is the way you need to approach
Step1:
Create an HTML page which can take an input from the users
Step 2:
After getting the data from the user, create a connection to the database and pass the searched string as an input paramater.
Step 3:
You will get a result set from a database
Step 4:
Iterate through the result set and display in the html page, if you require the url to be given for those url, so when user clicks So that he will be directed to those websites.
Sample Query:
Select * from table1 where url_Word like '%Search_String'
This will be the procedure that you need to follow to complete your work.
You do not need a database you need a text file. If this is a school project you need more information.