PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 8th, 2013, 01:06 PM
nicholasskearne nicholasskearne is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 nicholasskearne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 56 sec
Reputation Power: 0
PHP5 - Help with form

How come my php function wont respond when i press submit button in form??


<?php
include 'connect.php';
?>
<title>Registration</title>

<form method='post'>
<?php
if(isset($_POST['register_button'])){
$username = $_POST['username'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirm_password = $_POST['confirm_password'];

if(empty($username) or empty($first_name)){
echo'fields missing!';
} else if ($password != $confirm_password) {
echo"confirm password didnt match";
} else {
mysql_query("INSERT INTO members VALUES('', '$first_name', '$last_name', '$username', '$email', '$password')");
echo "Successfully Registered";
}

}
?>
Name: <br/>
<input type='text' name='first_name' />
<input type='text' name='last_name' />
<br /><br />
User Name : <br />
<input type='text' name='username' />
<br /><br/>
email ID : <br/>
<input type='email' name='email' />
<br/><br/>
Password :
</form><br>
<input type='password' name='password' />
<br/><br/>
Confirm Password:
<br/>
<input type='password' name='confirm_password' />
<br/><br/>
<input type='submit' value='submit' id='button' name='register_button' />

</form>

Reply With Quote Reply With Quote

Reply With Quote
  #2  
Old February 8th, 2013, 01:23 PM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,876 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 6 Days 19 h 6 m 53 sec
Reputation Power: 581
1) Please enclose your code in [ PHP ] tags. See the sticky at the top of this forum.
2) You need to better describe what is (not) happening. Are you getting a blank screen or is the submit button appearing to not do anything? You will need to check the logs to clarify either way.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old February 8th, 2013, 01:38 PM
nicholasskearne nicholasskearne is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 nicholasskearne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by gw1500se
1) Please enclose your code in [ PHP ] tags. See the sticky at the top of this forum.
2) You need to better describe what is (not) happening. Are you getting a blank screen or is the submit button appearing to not do anything? You will need to check the logs to clarify either way.



thanks for the tips i wil next time, but what is not happening is anything when i press the button. i cant connect the submit button to the function at all.

Reply With Quote
  #4  
Old February 8th, 2013, 01:45 PM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,876 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 6 Days 19 h 6 m 53 sec
Reputation Power: 581
Do you see anything in the log when you click the submit button? You first need to determine if the page is being executed and just outputting the identical info making it look like it is not executing or if is really is a no-op. I'd suggest you put something like this before the isset check:
PHP Code:
echo "<pre>";
print_r($_POST);
echo 
"</pre>"

Reply With Quote
  #5  
Old February 8th, 2013, 02:23 PM
nicholasskearne nicholasskearne is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 nicholasskearne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by gw1500se
Do you see anything in the log when you click the submit button? You first need to determine if the page is being executed and just outputting the identical info making it look like it is not executing or if is really is a no-op. I'd suggest you put something like this before the isset check:
PHP Code:
echo "<pre>";
print_r($_POST);
echo 
"</pre>"



Im not sure how to read the log, and when i put
PHP Code:
echo "<pre>";
print_r($_POST);
echo 
"</pre>"
[/QUOTE]
in it just reads as
Array
(
)

i guess my question is how do i get that form submit button to trigger my php code, sorry im a noob and thanks for your quick reply i appreciate it

Reply With Quote
  #6  
Old February 8th, 2013, 02:34 PM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,876 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 6 Days 19 h 6 m 53 sec
Reputation Power: 581
What that output implies is it is the first time on that page (i.e. $_POST is empty). The PHP code is executed/triggered every time you request that page. The only difference is when you click the submit button the page is executed with all the $_POST values filled in. That is what the debug I gave you was to show.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP5 - Help with form

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap