Jump to content

error on simple form


xwishmasterx

Recommended Posts

I have an error somewhere in the form as it does not output what I want it too. I know the form itself is working as I have added an echo to see if the form inputs are processed.

 

the code:

<?php
$amount = $_POST['amount'];
$member = $_POST['member'];

$sql = ("SELECT name FROM vtp_members WHERE name=".$member." ");
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
if($numrows = '1')
{
  while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
echo "You sent ". $amount . " to " . $member . ".<br />";
}
}
echo " ".$amount." and ".$member." ";
?>

 

It outputs the last echo correct.

 

is there anyone who can see what I'm doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/233149-error-on-simple-form/
Share on other sites

While you're at it, there's no need to concatenate the variables into the strings all the time like that. The output from the following is the same as what will be generated by your echoes.

 

echo "You sent $amount to $member<br />";
}
}
echo " $amount and $member";

While you're at it, there's no need to concatenate the variables into the strings all the time like that. The output from the following is the same as what will be generated by your echoes.

 

echo "You sent $amount to $member<br />";
}
}
echo " $amount and $member";

 

is there a performance difference with doing it this way? i always use the . concatenate method , just because i find it easier to read in notepad++, lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.