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
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";

Link to comment
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";

 

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

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.