Hi Everyone,

I am a bit new to using php/Mysql and i am having a little challenge.
I am creating an online form but on entering a value in one of the form fields, i want to add a link to check if that value is valid(ie if it does not already exist in the DB).

I have 2 tables -> codes, keywords
a code can have several keywords, but none of the keywords can occur more than once.
i want this link to be able to read a user's input for both the code and the keyword field and display a message if the keyword already exists on that code.

<html>
<head></head>
<body>
<form name="" action="<?php echo $_SERVER[PHP_SELF];?>" method = "post">
<input type="text" name="code">
<input type="text" name="keyword"><a>Check if keyword is available</a>
</form>
</body>
</html>

I want the link to run a query.

Please any help will be highly appreciated. Thanks.

Member Avatar for diafol

Sorry a bit slow here, can you give an example of typical user input to these fields and say what's allowed and what's not?

a code can have several keywords, but none of the keywords can occur more than once.
i want this link to be able to read a user's input for both the code and the keyword field and display a message if the keyword already exists on that code.

This didn't make much sense to me.

If you want to check the availability of a keyword, you'll need AJAX or you'll have to reload the page so that pHp can make a call to the server and the server can return the data to a fresh page.

Ajax will do all this without page reload.

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.