Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Calling a PHP Script

Posted by: safe2drive Mar 20 2012, 04:00 AM

have written my first PHP script to handle a contact form. After a few initial problems, the web hosting company changed a few lines of code around and said they have tested the script and all was working OK. Indeed I received the email with the details they had entered. However, I cannot get it to run at home and have tried 3 separate PC's and laptops. I have tried F5 etc. The mystery deepens as I tried it on my Iphone and Ipad and it works perfectly.

When you have entered all the details and hit the submit button, the php script isn't being called as is shown in the url from my Iphone.

This is the section in the contact form for the submit button.

form action="http://www.safe-2-drive.co.uk/myform.php" method="post">
<div class="form_settings">

<p><span>Name: *</span><input class="contact" type="text" name="yourname" value="" /></p>

<p><span>Contact No: *</span><input class="contact" type="text" name="contact" value="" /></p>

<p><span>E-mail:</span><input type="text" name="email" /></p>

<p><span>Driving Experience:</span> </p>

<form action="">
<select name="drivingexperience">
<option value="Never driven before">Never driven before</option>
<option value="Had a few lessons">Had a few lessons</option>
<option value="Just failed L test">Just failed L test</option>
<option value="Pass Plus">Want to take Pass Plus</option>
</select>
</form>
</p>
<p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="message"></textarea></p>

<p><span>Access Code: *</span><input type="text" name="code" size="10" maxlength="10" style="width:70px"/> &lt;- type <b>SAFE2DRIVE</b> here.<br />

<p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
</div>


This is the web site page -> safe-2-drive.co.uk.contact.html



Any help would be greatly apreciated.

Posted by: pandy Mar 20 2012, 06:58 AM

You have 2 start tags for FORM. Browsers choose the second one without attributes, so nothing happens.

Some form controls, among them the submit button, are outside the form. The form won't be submitted when you click the button because of this, it has no connection to the form.

The start tag for FORM also lacks the beginning '<', but I guess that was a mishap when pasting

I submitted the form (after corrections) and it worked. I used the name pandy and wrote "testing" in the textarea if you need to clean it out.


QUOTE
form action="http://www.safe-2-drive.co.uk/myform.php" method="post">
<div class="form_settings">

<p><span>Name: *</span><input class="contact" type="text" name="yourname" value="" /></p>

<p><span>Contact No: *</span><input class="contact" type="text" name="contact" value="" /></p>

<p><span>E-mail:</span><input type="text" name="email" /></p>

<p><span>Driving Experience:</span> </p>

<form action="">
<select name="drivingexperience">
<option value="Never driven before">Never driven before</option>
<option value="Had a few lessons">Had a few lessons</option>
<option value="Just failed L test">Just failed L test</option>
<option value="Pass Plus">Want to take Pass Plus</option>
</select>
</form>
</p>
<p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="message"></textarea></p>

<p><span>Access Code: *</span><input type="text" name="code" size="10" maxlength="10" style="width:70px"/> &lt;- type <b>SAFE2DRIVE</b> here.<br />

<p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
</div>

Posted by: safe2drive Mar 20 2012, 07:27 AM

Hi pandy,

Much appreciated and thanks for taking the time to solve my issue. I had a feeling it would be something simple.

Cheers.



QUOTE(pandy @ Mar 20 2012, 11:58 AM) *

You have 2 start tags for FORM. Browsers choose the second one without attributes, so nothing happens.

Some form controls, among them the submit button, are outside the form. The form won't be submitted when you click the button because of this, it has no connection to the form.

The start tag for FORM also lacks the beginning '<', but I guess that was a mishap when pasting

I submitted the form (after corrections) and it worked. I used the name pandy and wrote "testing" in the textarea if you need to clean it out.


QUOTE
form action="http://www.safe-2-drive.co.uk/myform.php" method="post">
<div class="form_settings">

<p><span>Name: *</span><input class="contact" type="text" name="yourname" value="" /></p>

<p><span>Contact No: *</span><input class="contact" type="text" name="contact" value="" /></p>

<p><span>E-mail:</span><input type="text" name="email" /></p>

<p><span>Driving Experience:</span> </p>

<form action="">
<select name="drivingexperience">
<option value="Never driven before">Never driven before</option>
<option value="Had a few lessons">Had a few lessons</option>
<option value="Just failed L test">Just failed L test</option>
<option value="Pass Plus">Want to take Pass Plus</option>
</select>
</form>
</p>
<p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="message"></textarea></p>

<p><span>Access Code: *</span><input type="text" name="code" size="10" maxlength="10" style="width:70px"/> &lt;- type <b>SAFE2DRIVE</b> here.<br />

<p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
</div>



Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)