| | |
validate form
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jan 2007
Posts: 58
Reputation:
Solved Threads: 2
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!
Regards!
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Jan 2007
Posts: 58
Reputation:
Solved Threads: 2
•
•
•
•
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.
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");
}
}
![]() |
Similar Threads
- Send a text message to your phone from your site! (ColdFusion)
- PHP: Form Validation (PHP)
- How to validate an image field with javascript (JavaScript / DHTML / AJAX)
- PHP Quote form (PHP)
- dreamweaver, PHP and submit form query (PHP)
- PHP Templating system (PHP)
Other Threads in the PHP Forum
- Previous Thread: A question about PHP
- Next Thread: Zune Site help
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube






