I am writing a PHP script to add data to a MySql database.
There is an input form to add the data and a Captcha before posting.
If the Captcha is entered correctly, everything works fine and the data is added to the database.
However, if the Captcha is entered incorrectly, the script re-directs to a resend page which loads up the data that was input on the original input page.
This is the part that does not work correctly.
Here is the part of the script that loads the resend page:
PHP Code:
// WRONG SECURITY CODE } else { header("Location: tcc_addrally.php?sdate=$sdate&rallydate=$rallydate&venue=$venue&route=$route&attractions=$attractions&officers=$officers&selection=$type&action=resend"); exit; } // WRONG SECURITY CODE
else if($action=="resend"){ $template = join('',file('tcc_addrally_resend.tpl')); $template = str_replace("[sdate]",$sdate,$template); $template = str_replace("[rallydate]",$rallydate,$template); $template = str_replace("[venue]",$venue,$template); $template = str_replace("[route]",$route,$template); $template = str_replace("[attractions]",$attractions,$template); $template = str_replace("[officers]",$officers,$template); $template = str_replace("[region]",$region,$template); print $template; exit; }
Here is the code for the resend page:
Code:
<form action="tcc_addrally.php" method="GET"> <center> <table align="center" width=600 cellspacing=5 cellpadding=0 border=0> <tr valign=top><td align= center colspan=2><font size="2" > <b>Start Date of rally:</b> <input name="sdate" size="40" value=[sdate]></font><br /> <b><font color="#ff0000">N.B:</font> This MUST be input in format <b><font color="#ff0000">dd-mm-yyyy</font></b> only <br /><br /> </td></tr> <tr valign=top><td align= center colspan=2><font size="2" > <b>Date of rally:</b> <input type="text" name="rallydate" size="40" value=[rallydate]></font><br /><br /> </td></tr> <tr valign=top><td align= center colspan=2><font size="2" > <b>Venue of rally:</b> <input type="text" name="venue" size="40" value=[venue]></font><br /><br /> </td></tr> <tr valign=top><td align= center colspan=2><font size="2" > <b>Route to rally:</b> <textarea name="route" cols="300" rows="10">[route]</textarea> </td></tr> <tr valign=top><td align= center colspan=2><font size="2" > <b>Attractions at rally:</b> <textarea name="attractions" cols="300" rows="10">[attractions]</textarea> </td></tr> <tr valign=top><td align= center colspan=2><font size="2" > <b>Officers of rally:</b> <input type="text" name="officers" size="40" value=[officers]></font><br /><br /> </td></tr> <tr> <td align="center" valign="TOP"><font size="2">Region:</font><br /> <select name="selection"> <option value="Please select">Please select... <option value="chil">Chiltern <option value="east">Eastern </select> <p> </td> </tr> <!--// CHECK SECURITY CODE--> <tr><td colspan=2 align=center> <img src="../files/CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br /> <font size="2" >Security Code: </font><input id="security_code" name="security_code" type="text" /><br /> <font size="4" color="#ff0000" ><b>Please re-enter the security code above the box, in the security code box. Make sure you enter the security code in the correct case as displayed.</b></font><p> </td></tr> <!--// CHECK SECURITY CODE--> <tr align=center><td colspan=2> <input type="button" value="Post" onclick="check <input type=reset value="Clear"> <input type="hidden" name="action" value="add"></input> </td></tr> </table> </center> </form>
These are the inputs on the forms:
Start date: (Orig) 12-07-2013---------------(Resend)12-07-2013
Date of rally: (Orig)12th - 14th July 2013---------------(Resend)12th
Venue: (Orig)Field Rise Kingsdown Lane---------------(Resend)Field
Route: Textarea
Attractions: Textarea
Officers: (Orig) Robert & Sharon Lane---------------(Resend)Robert
It appears to me that anything in a 'Textarea' displays in the resend form OK, but in an input box, it will only display up to the first 'space'.
Also, in a Textbox, the resend form will only display up to '&' and nothing after it.
Can anybody advise what is wrong with my coding ???
Thanks,
John C
Bookmarks