0

Simple HTML form is not working properly...
attached is a simple HTML form.
When i print the super global $_POST[] i don't get any information from the text fields.
Im really frustrated... I can't find any problem with the code...


HTML

<form method="POST" action="functions/process_payment.php" >
                	
                    <table id="creditCards">
                    	<tr>
                        	<td><input type="radio" name="creditCard" class="CreditCard" checked value="Visa"/><img src="images/checkout/visa.png" />&nbsp;Visa</td>
                            <td><input type="radio" name="creditCard" class="CreditCard" value="Mastercard"/><img src="images/checkout/master.png" />&nbsp;Master Card</td>
                            <td><input type="radio" name="creditCard" class="CreditCard" value="Amex"/><img src="images/checkout/amex.png" />&nbsp;Amex</td>
                        </tr>
                    </table>
                    
                    <table id="paymentInfo">
                    	<tr>
                        	<th>Card Holder Name:</th>
                            <td><input type="text" name"cardHolderName"  id="CardHolderName" /></td>
                        </tr>
                        <tr>
                        	<th>Card Number:</th>
                            <td><input type="text" name"cardNumber" id="CardNumber" /></td>
                        </tr>
                        <tr>
                        	<th>Card Expiry:</th>
                            <td>
                            <select name="ddlExpiryMonth" id="ddlExpiryMonth">
                            <option value="01">01</option>
                            <option value="02">02</option>
                            <option value="03">03</option>
                            <option value="04">04</option>
                            <option value="05">05</option>
                            <option value="06">06</option>
                            <option value="07">07</option>
                            <option value="08">08</option>
                            <option value="09">09</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                        	</select>
                   			<select name="ddlExpiryYear" id="ddlExpiryYear">
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                        	</select>
                            </td>
                        </tr>
                    </table>
                    
                    <table id="buttonsTable">
                    	<tr>
                        	<td> <input type="image" name="processPayment" src="images/checkout/processPayment.png" width="119" height="39"></td>
                            <td><a href="functions/cancel_order.php"><img src="images/checkout/cancelOrder.png" /></a></td>
                        </tr>
                    </table>
                </form>

PHP File

<?php
	print_r($_POST);
?>

Output

Array ( [creditCard] => Visa [ddlExpiryMonth] => 01 [ddlExpiryYear] => 10 [processPayment_x] => 72 [processPayment_y] => 30 )
7
Contributors
13
Replies
14
Views
7 Years
Discussion Span
Last Post by almostbob
Featured Replies
  • [COLOR="Green"][/COLOR]still the op hasnt noticed, THERE IS NO EQUAL SIGN IN THE NAME OF THE INPUTS THAT ARENT BEING POSTED THIS IS A HTML SCREWUP NOT A PHP SCREWUP yours [COLOR="Red"]WRONG[/COLOR] [icode]<input type="text" name"CardHolderName"[/icode] [COLOR="green"]correct[/COLOR] [icode]<input type='text' name='CardHolderName' [/icode] ?? Read More

0
<form method="POST" action="functions/process_payment.php" >

use like this. why you are using form methode post in capitals.

method="post"
0

It doesn't really matter since it's case-insensitive....

It's really frustrating
I just don't see the problem! im starting to think that there is a problem on my local server settings....

-1

lol u cant print the $_POST thats not right.u have to echo

$_POST[name of the text field here];
echo $_POST[creditCard]; make sure to use mysql_real_escape_string() if u are entering it in the databse?

Edited by SKANK!!!!!: n/a

0

$_POST is an associative array.
print_r() Prints human-readable information about a variable and it is the best
function to use when you want to print arrays...
since $_POST is an array, the best way to echo it is using print_r()...

I tried echo before printing the whole array and it's not working!

0

yours <input type="text" name"CardHolderName" mine <input type='text' name='CardHolderName' ??

Edited by almostbob: n/a

-1

ristar, if ur not going to even look at my post right, then i just wont help you. print_r is rediculous to use. u just need to echo each variable seperately!

0

$_POST is an associative array.
print_r() Prints human-readable information about a variable and it is the best
function to use when you want to print arrays...
since $_POST is an array, the best way to echo it is using print_r()...

You tried this and it didn't work, so maybe it isn't the best way.

Try echoing each value seperately, as has been suggested.

1

still the op hasnt noticed, THERE IS NO EQUAL SIGN IN THE NAME OF THE INPUTS THAT ARENT BEING POSTED
THIS IS A HTML SCREWUP NOT A PHP SCREWUP

yours WRONG <input type="text" name"CardHolderName" correct <input type='text' name='CardHolderName' ??

1

i agree with almostbob, this one really has an html screwup. i mean this is common sense change it and see if u have an airor now op! let me know if it solves all yo probs. kthx

Votes + Comments
Thank you
0

ditto evstevemd

any editor with code highlighting would throw an exception at the code errors, that is, change display colors where the code is not correct., makes simple omissions easy to spot

Notepad++
notepad2
just about any decent IDE

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.