validate form

Thread Solved

Join Date: Jan 2007
Posts: 58
Reputation: crazynp is an unknown quantity at this point 
Solved Threads: 2
crazynp crazynp is offline Offline
Junior Poster in Training

validate form

 
0
  #1
Jan 15th, 2007
can anyone please help me to build a form with validation. I am using the form in a html page and it is processed in another php page. The form has only radio buttons for five options.for example cash.if the required cash is less than the user's cash in the datbase, the form should have a red highlight letters telling that the "cash is not enough" in the same page with form.
Regards!
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: validate form

 
0
  #2
Jan 15th, 2007
Have you written any code for this yet? We can help you with what you have but we won't do the work for you. We're here to help, not be free labor.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 58
Reputation: crazynp is an unknown quantity at this point 
Solved Threads: 2
crazynp crazynp is offline Offline
Junior Poster in Training

Re: validate form

 
0
  #3
Jan 15th, 2007
Originally Posted by stymiee View Post
Have you written any code for this yet? We can help you with what you have but we won't do the work for you. We're here to help, not be free labor.
form page:
print("<table align=\"left\" width=\"200\" bgcolor=\"#CCCCCC\" border=\"1\" bordercolor=\"#000000\">");
print("<tr>");
print("<td colspan=\"3\"><p align=\"center\">Guns</p></td>");
print("</tr>");
$query="SELECT * FROM guns ";
$con=new Connection();
$con->setQuery($query);
$con->setDatabase('DB_NAME');
$sth=$con->runQuery();
?>
<form name="gunstransaction" action="process.php" method="POST">
<?php
$count=1;
while($row=mysql_fetch_array($sth,MYSQL_NUM)){
print("<tr>");
print("<td>");
?>
<input type="radio" name="guns" value="<?php echo("$count"); ?>"></input>
<?php
$count++;
print("</td>");
print("<td>");
print("$row[1]");
print("</td>");
print("<td>");
print("$");
print("$row[2]");
print("</td>");
}
print("</tr>");
print("<tr>");
print("<td colspan=\"3\">");

?>

<input type="hidden" name="subguns" value="1">
<p align=center><input type="submit" value="Buy !"></p>
</form>


process.php

$guns_id = $_POST['guns'];

$query="SELECT * FROM guns WHERE guns_id= '$guns_id'";
$con=new Connection();
$con->setQuery($query);
$con->setDatabase('DB_NAME');
$sth=$con->runQuery();
$row=mysql_fetch_array($sth,MYSQL_ASSOC);
$guns= $row['guns_name'];
$guns_price = $row['guns_price'];
if ($session->usercash <= $guns_price){

//echo("Not Enough Cash or you will have no cash left if this transaction is allowed.");
}
else{
$new_cash = $session->usercash - $guns_price;
$retval = $session->gunstransaction($guns, $new_cash);
header("Location: buy.php");
}
}
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 58
Reputation: crazynp is an unknown quantity at this point 
Solved Threads: 2
crazynp crazynp is offline Offline
Junior Poster in Training

Re: validate form

 
0
  #4
Jan 16th, 2007
Done by myself.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC