Jump to content

error checking keywords


DuaneCawaling

Recommended Posts

Type SMART[space]WALLET[space]keyword*

KEYWORDS:
register[space]password
bal
menu
drinks
snacks
buy[space]qty-item_keyword ex: ADZU WALLETbuy 1-M1,1-M2,3-S1
pass[space]password ex: ADZU WALLET pass 12345

 

i want to check all the errors that may occur in the scenario of inputing the different keywords.

for example:

ADZU WALLET pass

in this string, the error would be that there is no password ..a message should be shown to the user that it is an error

 

please help me check every possible error and scenario

:)

Link to comment
Share on other sites

What have you tried?

 

This section is for getting help with code that you're writing yourself, but have gotten stuck on for some reason. It's not for getting us to write the code for you, but for us to help you learn to do it yourself.

 

If you want others to do it for you, you'll need to post in the Freelancer section. Also, be prepared that this will most likely cost you money.

Link to comment
Share on other sites

<?php
echo ('Type <strong>ADZU</strong>[space]<strong>UEW</strong>[space]<em>keyword</em>*')."<br />";
echo "<em>KEYWORDS</em>:"."<br />".
		"<strong>register</strong>[space]<em>password</em>"."<br>"
		."<strong>bal</strong>"."<br />"."<strong>menu</strong>"."<br />"."<strong>drinks</strong>"."<br />"
		."<strong>snacks</strong>"."<br />"."<strong>buy</strong>[space]<em>qty-item_keyword</em> ex: ADZU UEW buy 1-M1"."<br />"
		."<strong>pass</strong>[space]<em>password</em>"."<br />";
?>
<form action="keyword.php" method="post">
 Message: <input type="text" name="message">
 Contact no.: <input type="text" name="number">
 <input type="submit">
 </form>

 

this is the code for asking message and mumber

 

<?php
$str_full = "$_POST[message]";		//full message
$number = "$_POST[number]";		//contact number
$message = explode(" ",$str_full);
$str_keyword = strtolower($message[2]); //----->message [2]

echo iskeyword($str_full,$str_keyword);

function iskeyword($word,$dummy){
	if($dummy == "register"){
		$msg = substr($word,17);
		$msg1 = str_replace(' ','',$msg);
		return $msg1;
	}else
	if($dummy == "bal"){
		$msg = substr($word,12);
		$msg1 = str_replace(' ','',$msg);
		return $msg1;
	}
	if($dummy == "buy"){
		$msg = substr($word,12);
		$msg1 = str_replace(' ','',$msg);
		return $msg1;
	}
}
?>

 

this is the part im checking for errors in some keywords, im still in the process of finishing the codes 

Link to comment
Share on other sites

I don't see any attempts to check for missing input there, at all. Nor do I see any specific questions as to what you're having a difficulty with. So I'm forced to assume that you haven't tried to solve this on your own, at all, and is just looking for people to work for free.

As previously noted: This is not the correct section for that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.