2 Replies - 1050 Views - Last Post: 20 June 2014 - 04:45 PM

#1 ILoveKnowledge   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 18-March 10

Form not submitting

Posted 20 June 2014 - 10:49 AM

Greetings,

I have everything set up and the form is perfect and works great...except when I try to submit! I have tried looking at everything and cannot figure out why it is not working. When I click on the "Submit" button the button just disappears and does not submit any data. I tried to run it into a form validator and it still does not work.

Here is the code..:
<form action="http://www.xyz.com/fmail.php" method="post">
<table cellspacing="1">
<tr>
<td>First Name:<br />
<input type="text" id="first_name" name="first_name" class="textbox" maxlength="25" /></td>
<td class="right">Last Name:<br />
<input type="text" id="last_name" name="last_name" class="textbox" maxlength="25" /></td>
</tr>
<tr>
<td>Email Address:<br />
<input type="text" id="email" name="email" class="textbox" maxlength="60" /></td>
<td class="right">Zip Code:<br />
<input type="text" id="zip_code" name="zip_code" class="textbox" maxlength="5" /></td>
</tr>
<tr>
<td class="phone mul">Primary Phone:<br />
<input type="text" id="pri_areacode" name="pri_areacode" class="textbox small" maxlength="3" /> - <input type="text" id="pri_prefix" name="pri_prefix" class="textbox small" maxlength="3" /> - <input type="text" id="pri_suffix" name="pri_suffix" class="textbox medium" maxlength="4" /></td>
<td class="right phone mul">Alternate Phone:<br />
<input type="text" id="alt_areacode" name="alt_areacode" class="textbox small" maxlength="3" /> - <input type="text" id="alt_prefix" name="alt_prefix" class="textbox small" maxlength="3" /> - <input type="text" id="alt_suffix" name="alt_suffix" class="textbox medium" maxlength="4" /></td>
</tr>
<tr>
<td>Preferred Contact Time:<br />
<select id="contact_time" name="contact_time" class="c1">
<option value="select">Select one</option>
<option value="morning">Morning</option>
<option value="afternoon">Afternoon</option>
<option value="evening">Evening</option>
</select></td>
<td class="right">
<div id="fb"><input type="checkbox" id="newsletter" name="newsletter" checked="checked" /> Yes! I would like to receive other<br />
helpful financial tips and <a href="#" title="You will receive our Free&lt;br /&gt;newsletter.&lt;br /&gt;You may cancel at anytime.">offers</a>.</div>
</td>
</tr>
<tr>
<td colspan="2" class="center c2">Do you have at least $10,000 in credit card debt? <input type="radio" name="over_ten" value="yes" /> Yes <input type="radio" name="over_ten" value="no" /> No</td>
</tr>
<tr class="hideme">
<td colspan="2" class="center"><a href="#">Unsecured Debt Amount:</a> <select id="debt_amount" name="debt_amount" class="c1">
<option value="select">Select one</option>
<option value="1">$10,000-12,499</option>
<option value="2">$12,500-14,999</option>
<option value="3">$15,000-17,499</option>
<option value="4">$17,500-19,999</option>
<option value="5">$20,000-24,999</option>
<option value="6">$25,000-29,999</option>
<option value="7">$30,000-39,999</option>
<option value="8">$40,000-49,999</option>
<option value="9">$50,000-74,999</option>
<option value="10">$75,000-99,999</option>
<option value="11">$100,000+</option>
<option value="12">I wish not to disclose</option>
</select></td>
</tr>
<tr class="hideme">
<td colspan="2" class="center">Debt Amount: <select id="debt_amount2" name="debt_amount2" class="c1">
<option value="select">Select one</option>
<option value="1">$100-999</option>
<option value="2">$1,000-1,999</option>
<option value="3">$2,000-2,999</option>
<option value="4">$3,000-3,999</option>
<option value="5">$4,000-4,999</option>
<option value="6">$5,000-5,999</option>
<option value="7">$6,000-6,999</option>
<option value="8">$7,000-7,999</option>
<option value="9">$8,000-8,999</option>
<option value="10">$9,000-9,999</option>
</select></td>
</tr>
</table>
<div id="fbottom"><input type="image" id="submit" src="/xyz/button.gif" /></div>
</form>


Thanks in advance for your help. :)

Is This A Good Question/Topic? 0
  • +

Replies To: Form not submitting

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5554
  • View blog
  • Posts: 14,560
  • Joined: 18-April 07

Re: Form not submitting

Posted 20 June 2014 - 04:25 PM

Using an image as a submit button type is a bit tricky when it comes to PHP processing. First make sure to give the button a name attribute, so PHP can recognize it. So let's say we give it the name "btnSend". We should also give it some value using a value attribute. We can check for this button in the PHP by using "btnSend_x". But wait, what is with the underscore x? Well that is the trick. When you use an image as a submit button, PHP has to look at all the elements and determine that this image is being used as a submit button. It does this by looking for an image x and y value... usually submitted as btnSend.x or btnSend.y, but PHP translates that to btnSend_x or btnSend_y.

It is one of those kooky things and one reason that most developers don't use images as submit buttons. They can instead take a regular submit button, and through CSS, restyle it into an image looking button.

So again in PHP you would be looking for $_POST["btnSend_x"] and if that is set, then you know the form is being sent. I imagine your form is being sent but your PHP file is not recognizing the form submit button.

:)
Was This Post Helpful? 1
  • +
  • -

#3 andrewsw   User is online

  • palpable absurdity
  • member icon

Reputation: 6916
  • View blog
  • Posts: 28,598
  • Joined: 12-December 12

Re: Form not submitting

Posted 20 June 2014 - 04:45 PM

Martyr2 Weird :online2long: .. what's 'y' for?

I haven't tested but if the image-input has a name then isn't it posted along with the other data, based on, and referred to by, its name?

Perhaps php stands for post, hope, and pray.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1