Form button not functioning in the web server

Links for php scripts

Moderators: macek, egami, gesf

IamNew
New php-forum User
New php-forum User
Posts: 28
Joined: Fri Nov 04, 2011 6:29 am

Form button not functioning in the web server

Postby IamNew » Sat Jun 23, 2012 1:47 am

Hi there,

I have my site tested fine in localhost and problem occurred when I hosted them to the web server. Everything working fine but the submit button just wont work as it should be. It tested fine before i host my site to the server.

I have surf the net and posted in numerous of forums and still could now get the solution for my problem.

Here is my code (form button):

Code: Select all

echo"<tr>";
   echo"<td align='right'><form id='frmx3' name='frmx3' method='POST' action='pending.php'>
<input name='button3' method='POST' type='submit' id='button3' value='Approve' align='right'/>
<input name='approveidll' type='hidden' id='approveidll' value='$number' />"."</form></td></tr>";


Here's the function code for the button when it is clicked:

Code: Select all

if ((isset($_POST['approveidll'])) && ($_POST['approveidll'] != "")) {
      
$insertsql = sprintf("SELECT * FROM pending WHERE pending_item = %s", GetSQLValueString($_POST['approveidll'], 'text'));
      
$deleteSQL = sprintf("DELETE FROM pending WHERE
  pending_item=%s",
                       GetSQLValueString($_POST['approveidll'], 'text'));


Please advise.

User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 283
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Form button not functioning in the web server

Postby freshnet » Sat Jun 23, 2012 7:01 am

Ok a few things you could do to tidy up your code.
Firstly, you don't need method='post' in the input html. Get rid of that.
Secondly, this code

Code: Select all

((isset($_POST['approveidll'])) && ($_POST['approveidll'] != ""))

is the same as

Code: Select all

(!empty($_POST['approveidll'])


Thirdly, you're better off assigning all POST variables to a regular variable and escaping them

Code: Select all

$approveidll = addslashes($_POST['approveidll']);


Fourthly, what is 'getSQLvaluestring', and where is it defined?

Finally, and perhaps most importantly, when you say it's not functioning, what is it doing or not doing? Does any POST variable work?


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests

cron