Free Web Hosting Forum
(#1 (permalink))
Old
kei's Avatar
kei kei is offline
Senior Member
kei is an unknown quantity at this point
 
Posts: 229
Join Date: Jun 2010
Default [php] custom error reporting - 12-01-2010, 12:30 AM

how do you error report?
for example im working on a signup page;
after i submit my name and pass, (lets pretend my nick is already taken) right now i redirect back to the signup page with a 'get' &error=1 then do this so the error displays next to the input.

PHP Code:
if (isset($_GET['error']) && $_GET['error'] == 1){
echo 
"User name already taken!" 
but the "get" in the url makes it seem messy :/ how do you do it?
________
Web shows

Last edited by kei; 08-30-2011 at 06:22 AM.
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Leder678's Avatar
Senior Member
Leder678 is on a distinguished road
 
Posts: 1,430
Join Date: Jan 2009
Location: Norway
Send a message via MSN to Leder678
Default 12-01-2010, 05:39 AM

with jQuery

Here's and example of how to do it:

post.php
Code:
<?php
echo $_POST['name'];
?>
js.js
Code:
//<![CDATA[

	function rResult(data, textStatus) {
		$("#results").html(data); // returns echo $_POST['name'] in the id field results
	}
	
	function post() {
		var name = $("#name").val(); //get the value of the object with the id="name"
		$.post("post.php", { "name": name }, rResult);
	}
//]]>
index.php
Code:
<script type="text/javascript" src="http://europemafia.com/system/js/jquery.js"></script>
<script type="text/javascript" src="js.js"></script>
<div id="results"></div>
<input type="text" id="name" onkeypress="{if (event.keyCode==13)post()}" />

By the way, I would download the jquery api and not use the eurpemafia.com/system/js/jquery.js api


Follow me on twitter @Mortenrb

W3Fools - Read and learn

Please AT LEAST read the 10 bolded lines of the TOS at:
http://www.000webhost.com/includes/tos.php

Last edited by Leder678; 12-05-2010 at 12:04 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com