leachus2002 Posted June 17, 2010 Share Posted June 17, 2010 Hi There, I was wondering if there was any way that I can script, when I click on a link, for example "delete post" button, it will execute an sql statement and refresh the page? Could it be done in a way that if, say, the "$_GET['variable'] was blank, that the statement would not run? I am looking for ideas Cheers Matt Link to comment https://forums.phpfreaks.com/topic/205038-running-sql-statement-from-link/ Share on other sites More sharing options...
Mr_J Posted June 17, 2010 Share Posted June 17, 2010 is this t check if the field(s) were empty? or if the row is blank in the db? Link to comment https://forums.phpfreaks.com/topic/205038-running-sql-statement-from-link/#findComment-1073350 Share on other sites More sharing options...
leachus2002 Posted June 17, 2010 Author Share Posted June 17, 2010 It is to check that the variable is empty - for example, I could use PHP_SELF - so if PHP_SELF was empty, do not run delete statement, else, run delete statement with variable. Make sense? Thanks Matt Link to comment https://forums.phpfreaks.com/topic/205038-running-sql-statement-from-link/#findComment-1073351 Share on other sites More sharing options...
Mr_J Posted June 17, 2010 Share Posted June 17, 2010 It sounds like a simple verification... Are you going to use it in a form? if so, <form action="processor.php" onSubmit="validate_field($field)"> function validate_field($field){ if ($field=<0); echo 'Field is empty'; else ($field=>0); echo 'field is not empty' } Or just do it vice-verse Link to comment https://forums.phpfreaks.com/topic/205038-running-sql-statement-from-link/#findComment-1073367 Share on other sites More sharing options...
leachus2002 Posted June 17, 2010 Author Share Posted June 17, 2010 Ah superb, that's great - thanks for that. Will that refresh the page for me? Thanks Matt Link to comment https://forums.phpfreaks.com/topic/205038-running-sql-statement-from-link/#findComment-1073372 Share on other sites More sharing options...
Mr_J Posted June 17, 2010 Share Posted June 17, 2010 Yes, Do a google search to get some validation examples. It really is very basic... can do a lot 4 u though http://www.google.co.za/#hl=en&source=hp&q=validate+form+field+in+php&btnG=Google+Search&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=13fd6bee03f38c50 Link to comment https://forums.phpfreaks.com/topic/205038-running-sql-statement-from-link/#findComment-1073376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.