Jump to content

I'm unable to use $_Post, and I don't know why


IChaps
 Share

Recommended Posts

Hello.

 

I've created a small form with 6 text boxes and 2 select boxes/fields.

 

The problem I'm facing is that I'm unable to post from the form to another php file.

 

In the html form, I've written:-

<form action="newmember.php" method="POST">
<table>
<tr>
<td>Full Name / Business Name:</td>
<td><input name="txtAccountName" size="20" maxlength="50"></td>
<td></td>
</tr>
<tr>
<td>Username:</td>
<td><input name="txtUsername" size="20" maxlength="50"></td>
<td></td>
</tr>
<tr>
<td>EMail:</td>
<td><input name="txtEmail" size="20" maxlength="100"></td>
<td></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="txtPassword" type="password" size="20" maxlength="20"></td>
<td></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input name="txtConfirm_Password" type="password" size="20"></td>
<td></td>
</tr>
<tr>
<td>DOB:</td>
<td><input name="txtdob" size="12" value="dd/mm/yyyy" maxlength="12"></td>
<td></td>
</tr>
<tr>
<td>Membership Type:</td>
<td><select name="comMembership" size="1">
<option selected="selected">Individual</option>
<option>Business</option>
</select>
</td>
<td></td>
</tr>
<tr><td></td></tr>
<tr>
<td>You Agree to our<br> Terms and Conditions,<br> and Privacy/Cookies Notice.</td>
<td><select name="txtAgree" size="1">
<option selected="selected">N</option>
<option>Y</option>
</select>
</td>
</tr>
</table>
<input name="submit" type="image" src="/mainimages/submit.jpg" style="border: 0" alt="">
</form>

 

And in the newmember.php file I've so far written:-

 

<?php
// Check Entries
$New_Agree = $_POST["txtAgree"];
$New_Fullname = $_POST["txtAccountName"];
$New_Username = $_POST["txtUsername"];
$New_EMail = $_POST["txtEmail"];
$New_Password = $_POST["txtPassword"];
$New_Confirm_Password = $_POST["txtConfirm_Password"];
$New_Dob = $_POST["txtdob"];
$New_Membership = $_POST["comMembership"];

?>

 

I'd just like to ask:-

1. Dose my coding look correct, as I've not been faced with posting problem before?

2. Should I place the $_POST in html instead of php?

3. Oh yes, I've found that the DOB is posted ok, however I've placed value="dd/mm/yyyy" as a temporary measure only.

 

I'd be grateful for any ideas or guidance/help.

 

Thank You very much.

Link to comment
Share on other sites

It should work fine, only validation error is alt attribute on input type image should not have empty value. insert var_dump($_POST) in php fiile it should an array of values sent through $_POST.

 

Make sure both files are in same directory, and the php file matches exactly letter for letter, including uppercase or lowercase characters used for value of action attribute.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...