Connecting Tech Pros Worldwide Forums | Help | Site Map

Validation Required

Newbie
 
Join Date: Mar 2008
Posts: 18
#1: Mar 13 '08
Hi friends,
I am new to PHP. i need validations for Delete a record.

i store a column from Database table in a tabular format. i have edit and delete option. i need to write validations confirm (yes or no to delete the record) my code goes like this::::::

echo "<td width='68' ><a href='index2.php?option=com_qualification&cid=$cid &type=delete'> Delete</a> </td>";

// how to write validation in the above href and where to place it. plz suggest.

Regards,
Ram

Member
 
Join Date: Nov 2007
Location: Russia, Saint-Petersburg
Posts: 82
#2: Mar 13 '08

re: Validation Required


Hi.
Is it what you are looking for?

[HTML]<a href="index2.php?option=com_qualification&cid=$cid &type=delete" onclick="return confirm('Delete item?');">Delete</a>[/HTML]
Newbie
 
Join Date: Mar 2008
Posts: 18
#3: Mar 13 '08

re: Validation Required


Quote:

Originally Posted by satas

Hi.
Is it what you are looking for?

[HTML]<a href="index2.php?option=com_qualification&cid=$cid &type=delete" onclick="return confirm('Delete item?');">Delete</a>[/HTML]


hi satas,

i am getting the error, can u correct me where i am going wrong! plz

Parse error: syntax error, unexpected T_RETURN, expecting ',' or ';' in
Member
 
Join Date: Nov 2007
Location: Russia, Saint-Petersburg
Posts: 82
#4: Mar 13 '08

re: Validation Required


Try this:
[PHP]echo "<td width='68' ><a href='index2.php?option=com_qualification&cid=$cid &type=delete' onclick='return confirm(\"Delete item?\");'> Delete</a> </td>";[/PHP]
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#5: Mar 13 '08

re: Validation Required


Quote:

Originally Posted by Ramu528

hi satas,

i am getting the error, can u correct me where i am going wrong! plz

Parse error: syntax error, unexpected T_RETURN, expecting ',' or ';' in

Ramu, how are we supposed to know where that error is? We aren't psychics.

Post the relevant code and post the full error statement.
Newbie
 
Join Date: Mar 2008
Posts: 18
#6: Mar 13 '08

re: Validation Required


Quote:

Originally Posted by markusn00b

Ramu, how are we supposed to know where that error is? We aren't psychics.

Post the relevant code and post the full error statement.

Hi friends,

i able correct my code with help of SAMAS. thanks samas.

its first time, sorry, i will post my code with error from next time.
good day.
Newbie
 
Join Date: Mar 2008
Posts: 18
#7: Mar 13 '08

re: Validation Required


Quote:

Originally Posted by satas

Try this:
[PHP]echo "<td width='68' ><a href='index2.php?option=com_qualification&cid=$cid &type=delete' onclick='return confirm(\"Delete item?\");'> Delete</a> </td>";[/PHP]

hi satas, can we write our own validation, i mean writing function like this::

onclick="gotodelete(row(id))";

can u help me out here.

with 'return confirm' i am not able to delete the record. But i am showing alert message and when pressing ok button , the page is just refreshing.

plz satas.
Member
 
Join Date: Nov 2007
Location: Russia, Saint-Petersburg
Posts: 82
#8: Mar 13 '08

re: Validation Required


Hi Ramu528.
You should insert URL to some script that will delete the record.
e.g. < a href="delrec.php?rowid=1">delete</a>
In delrec.php you should receive rowid parameter and perform necessary actions.
After that you can return to previous page by using:
[PHP]header("Location: http://blah-blah.com/index.php");[/PHP]
Newbie
 
Join Date: Mar 2008
Posts: 18
#9: Mar 13 '08

re: Validation Required


Quote:

Originally Posted by satas

Hi Ramu528.
You should insert URL to some script that will delete the record.
e.g. < a href="delrec.php?rowid=1">delete</a>
In delrec.php you should receive rowid parameter and perform necessary actions.
After that you can return to previous page by using:
[PHP]header("Location: http://blah-blah.com/index.php");[/PHP]


Thanks Satas. I could complete my task with ur cooperation. thanks alot.
All the Best
Reply