![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
dc_jt
-
Posts
290 -
Joined
-
Last visited
Never
Posts posted by dc_jt
-
-
Ahh
I have created a back button using
<input class="databut" type="button" value="Back" onClick="document.location='<?=$_SERVER['PHP_SELF']?>';"/>
This takes me back but the details arent still in the form. How come when the browser button is pressed they are but with this button theyre not?
*edited* -
By pressing the back button in the browser, this returns the user to the input form with the correct details still entered. Therefore, surely I could just put a back button in my form without the use of a session, what do you think?
Thanks -
Is it possible to create a button in the error form so that when the user presses this they are returned to the input form with the fields they entered correctly still input??
Or is a session needed? -
Thanks a lot, great help!
All I need now is a back button to get back to the form :) -
Looking at the picture I want the error messages shown without the input form. And then I am planning on creating a button in the error messages box to go back to the input form.
Any ideas how to do this? My code is as follows:
[code]<form name="myform" method="post" action="<?=$_SERVER['PHP_SELF']?>">
<div class="home_text">
<?php
if ($sMode == 'complete')
{
echo '<div class="complete"><div class="formwrapper">Thank You for submitting your details.</div>';
}
else
{
?>
<? if(is_array($aErrors) && count($aErrors) > 0)
{
?>
<ul><div class="formwrapper">
<?
foreach($aErrors as $sError)
{
echo '<li>'.$sError.'<br></li>';
} // end foreach
?><br /></ul><?
} //end if (is_array($aErrors)...
?>
<div class="formwrapper">
<div class="textlabel">Name*</div><div class="formlabel"> <input name="Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Name']))?>" />
</div>
<div class="textlabel">Email*</div>
<div class="formlabel"> <input name="Email" type="text" class="dataform" value="<?=(stripslashes($_POST['Email']))?>"/>
</div>
<div class="textlabel">Address*</div>
<div class="formlabel">
<textarea name="Address" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Address']))?></textarea>
</div>
<div class="textlabel">Business Name*</div>
<div class="formlabel"> <input name="Business_Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Business_Name']))?>"/>
</div>
<div class="textlabel">Type of Business*</div>
<div class="formlabel"> <input name="Type_of_Business" type="text" class="dataform" value="<?=(stripslashes($_POST['Type_of_Business']))?>"/>
</div>
<div class="textlabel">Comments</div>
<div class="formlabel">
<textarea name="Comments" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Comments']))?></textarea>
</div>
<div class="textlabel"> </div><div class="formlabel">
<input name="Submit" type="submit" class="databut" value="Submit" />
<input type="hidden" name="mode" value="apply" />
<br class="clear"/>
</form>[/code]
This is class with the errors in by the way:
[code]private function ValidateClientData($aPostData)
{
$aErrors = array();
if(!$aPostData['Name'])
{
$aErrors['Name']='Please enter your Name';
}
if(validateemail($aPostData['Email'])===false)
{
$aErrors['Email']='Please enter a valid Email address';}
//if(validateemail(!$aPostData['Email'])===false)
//{
// $aErrors['Email']='Please enter your Email';
//}
if(!$aPostData['Address'])
{
$aErrors['Enquiry']='Please enter your Address';
}
if(!$aPostData['Business_Name'])
{
$aErrors['Business_Name']='Please enter your Business Name';
}
if(!$aPostData['Type_of_Business'])
{
$aErrors['Type_of_Business']='Please enter your Type of Business';
}
if (count($aErrors) > 0) return array(false, $aErrors);
return array(true);
}
}
?>[/code]
[URL=http://img356.imageshack.us/my.php?image=picss2.png][IMG]http://img356.imageshack.us/img356/9508/picss2.th.png[/img][/URL] -
Ive done the email validation thats in my class.
I just wanted to stop people from just simply pressing the space bar rather than input data
Thanks anyway for your help -
Hi I have created a form where a user inputs their details.
I want to be able to make the form not accept if someone simply just enters a load of ///// or just presses space bar to fill in the form.
I thought stripslashes would do this but it doesnt. Any ideas?
Here is my form:
[code]
<div class="formwrapper">
<div class="textlabel">Name</div><div class="formlabel"> <input name="Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Name']))?>" />
</div>
<div class="textlabel">Email</div>
<div class="formlabel"> <input name="Email" type="text" class="dataform" value="<?=(stripslashes($_POST['Email']))?>"/>
</div>
<div class="textlabel">Address</div>
<div class="formlabel">
<textarea name="Address" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Address']))?></textarea>
</div>
<div class="textlabel">Business Name </div>
<div class="formlabel"> <input name="Business_Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Business_Name']))?>"/>
</div>
<div class="textlabel">Type of Business </div>
<div class="formlabel"> <input name="Type_of_Business" type="text" class="dataform" value="<?=(stripslashes($_POST['Type_of_Business']))?>"/>
</div>
<div class="textlabel">Comments</div>
<div class="formlabel">
<textarea name="Comments" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Comments']))?></textarea>
</div>
<div class="textlabel"> </div><div class="formlabel">
<input name="Submit" type="submit" class="databut" value="Submit" />
<input type="hidden" name="mode" value="apply" />
<br class="clear"/>
</form>
[/code] -
Any idea Ray or anyone else?
Thanks -
This is the form in the index file
[code] <form name="myform" method="post" action="<?=$_SERVER['PHP_SELF']?>">
<div class="home_text">
<?php
if ($sMode == 'complete')
{
echo '<div class="complete">Thank You for submitting your details.</div>';
}
else
{
?>
<? if(is_array($aErrors) && count($aErrors) > 0)
{
?>
<ul>
<?
foreach($aErrors as $sError)
{
echo '<li>'.$sError.'<br></li>';
} // end foreach
?></ul><?
} //end if (is_array($aErrors)...
?>
<div class="formwrapper">
<div class="textlabel">Name</div><div class="formlabel"> <input name="Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Name']))?>" />
</div>
<div class="textlabel">Email</div>
<div class="formlabel"> <input name="Email" type="text" class="dataform" value="<?=(stripslashes($_POST['Email']))?>"/>
</div>
<div class="textlabel">Address</div>
<div class="formlabel">
<textarea name="Address" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Address']))?></textarea>
</div>
<div class="textlabel">Business Name </div>
<div class="formlabel"> <input name="Business_Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Business_Name']))?>"/>
</div>
<div class="textlabel">Type of Business </div>
<div class="formlabel"> <input name="Type_of_Business" type="text" class="dataform" value="<?=(stripslashes($_POST['Type_of_Business']))?>"/>
</div>
<div class="textlabel">Comments</div>
<div class="formlabel">
<textarea name="Comments" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Comments']))?></textarea>
</div>
<div class="textlabel"> </div><div class="formlabel">
<input name="Submit" type="submit" class="databut" value="Submit" />
<input type="hidden" name="mode" value="apply" />
<br class="clear"/>
</form>[/code]
This is the RCLTblClients class
[code]private function ValidateClientData($aPostData)
{
$aErrors = array();
if(!$aPostData['Name'])
{
$aErrors['Name']='Please enter your Name';
}
if(validateemail($aPostData['Email'])===false)
{
$aErrors['Email']='Please enter a valid Email address';}
//if(validateemail(!$aPostData['Email'])===false)
//{
// $aErrors['Email']='Please enter your Email';
//}
if(!$aPostData['Address'])
{
$aErrors['Enquiry']='Please enter your Address';
}
if(!$aPostData['Business_Name'])
{
$aErrors['Business_Name']='Please enter your Business Name';
}
if(!$aPostData['Type_of_Business'])
{
$aErrors['Type_of_Business']='Please enter your Type of Business';
}
if (count($aErrors) > 0) return array(false, $aErrors);
return array(true);
}
}[/code]
Is that enough for you? (*Hope this works*) -
Well I dont actually have an error. When I say error messages, they are there on purpose because the user has not entered all their details correctly. For example, if they entered nothing it would say:
# Please enter your Name
# Please enter a valid Email address
# Please enter your Address
# Please enter your Business Name
# Please enter your Type of Business
However, this is displayed directly above the input form.
Instead I want it to be displayed INSIDE the form, replacing the Name, Email, Address etc fields and then having a back button which then brings these fields back for the user to input correctly??
Do you understand? Sorry its confusing, but is this possible?
Thanks -
-
I did do that and when i click post it says:
The requested URL could not be retrieved
While trying to retrieve the URL: http://www.phpfreaks.com/forums/index.php?
The following error was encountered:
* Read Error
The system returned:
(104) Connection reset by peer
An error condition occurred while reading data from the network. Please retry your request.
Your cache administrator is root. -
I cant for some reason it says URL could not be retrieved??
-
Hi
I have an input form which displays errors if one or more fields are not completed. E.g. Please enter name.
However, these appear above the input form which then moves the input form further down the page and out of place. Is there anyway, once the form is submitted, the error messages are shown inside the input form (well inside the outline of it) replacing the input values name, email etc, with a button to go back which then displays the input form with the missing input?
If you understood that, any help would be great thanks
How to get rid of form?
in PHP Coding Help
Posted
<input class="databut" type="button" value="Back" onClick='self.history.back();'>
Thanks