Jump to content

Recommended Posts

Of couse I have an echo $_POST['register']; to see if the name attribute is being passed.

 

<html>
<head>
<title>Register for FREE Shopping Cart</title>
<link href="style_sheet.css" rel="stylesheet" media="screen">
</head>
<body>
<table align="center">
<tr>
<td>
<fieldset><legend>Register Here</legend>
<table>
<tr>
	<td>
<form action="register.php" method="post">
	<table>
		<tr>
			<td>
			Username:
			</td>
			<td>
			<input type="text" id="username" name="username" size="32" value="<?php if(isset($_POST['username'])){echo $_POST['username'];}?>" />
			</td>
		</tr>
		<tr>
			<td>
			Password:
			</td>
			<td>
			<input type="password" id="password" name="password" size="32" value="" />
			</td>
		</tr>
		<tr>
			<td>Re-password:
			</td>
			<td><input type="password" id="password_confirmed" name="password_confirmed" size="32" value="" /></td>
		</tr>
		<tr>
			<td>Email:
			</td>
			<td><input type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /></td>
		</tr>
		<tr>
			<td colspan="2" align="center" class="style7">
			You must confirm the email address before activating your account.
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
			<input type="image" src="/images/registermyaccount.gif" value="register" name="register"/>
			</td>
		</tr>
	</table>
</form>
	</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/63353-image-submit-button/#findComment-315727
Share on other sites

We need to see the script that processes the form data, i.e. register.php

 

It's NOT $_POST['register'].  It's either $_POST['register_x'] or $_POST['register_y']. Image submits work like image maps - they give the x and y coordinates of where the image was clicked relative to the top left corner.

Link to comment
https://forums.phpfreaks.com/topic/63353-image-submit-button/#findComment-315730
Share on other sites

o snap. I don't know anything about maps. is there a good tutorial to learn from. I thought it worked just like 'button' and 'submit'.

 

My script doesn't do anything until the $_POST['register'] is set. I.E. if (isset($_POST['register'])) { //run the script }

 

so basically i need to change the $_POST['register_x'] or $_POST['register_y']?

Link to comment
https://forums.phpfreaks.com/topic/63353-image-submit-button/#findComment-315733
Share on other sites

<?php
require_once('db.php');
include('functions.php');
$Username = $_POST['username'];
$Username_checked = strip_tags($Username);
if(isset($_POST['register']))
{		
	if($Username_checked!='' && $_POST['password']!='' && $_POST['password']==$_POST['password_confirmed'] && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && checkUnique('Username', $Username_checked)==TRUE && checkUnique('Email', $_POST['email'])==TRUE) 
	{

		$query = mysql_query("INSERT INTO users (`Username` , `Password`, `Email`, `Random_key`) VALUES ('".mysql_real_escape_string($Username_checked)."', '".mysql_real_escape_string(md5($_POST['password']))."', '".mysql_real_escape_string($_POST['email'])."', '".random_string('alnum', 32)."')") or die(mysql_error());

		$getUser = mysql_query("SELECT ID, Username, Email, Random_key FROM users WHERE Username = '".mysql_real_escape_string($Username_checked)."'") or die(mysql_error());

		if(mysql_num_rows($getUser)==1) {

			$row = mysql_fetch_assoc($getUser);
			$headers = 	'From: webmaster AT realfinancialsuccess.com' . "\r\n" .
    					'Reply-To: webmaster AT realfinancialsuccess.com' . "\r\n" .
    					'X-Mailer: PHP/' . phpversion();
			$subject = "Activation email from Free Cart";
			$message = "Dear ".$row['Username'].", this is your activation link to join our website. In order to confirm your membership please click on the following link: http://www.realfinancialsuccess.com/freeCart/confirm.php?ID=".$row['ID']."&key=".$row['Random_key']." Thank you for joining";
			if(mail($row['Email'], $subject, $message, $headers))
			{//we show the good guy only in one case and the bad one for the rest.
				$msg = 'Account created. Please login to the email you provided during registration and confirm your membership.';
			}
			else {
				$error = 'I created the account but failed sending the validation email out. Please inform my boss about this cancer of mine';
			}
		}
		else {
			$error = 'You just made possible the old guy (the impossible). Please inform my boss in order to give you the price for this.';
		}

	} else {
	$taken = mysql_query("SELECT Username FROM users WHERE Username = '{$Username_checked}'") or die(mysql_error());
	$username_taken = mysql_fetch_array($taken) or die(mysql_error());
		if ($username_taken) {
		$error = 'The Username is already taken or you have illegal characters for your username. The Username may only contain numbers, letters, and underscores.';
		} else {		
		$error = 'There was an error in your data. Please make sure you filled in all the required data, you provided a valid email address and that the password fields match';
		}	
	}
}
?>
<?php if(isset($error)){ echo $error;}?>
<?php if(isset($msg)){ echo $msg;} else {?>

Link to comment
https://forums.phpfreaks.com/topic/63353-image-submit-button/#findComment-315754
Share on other sites

Then you have a logic or database problem with the code that follows.  Checking that an image button is clicked requires you verify that either an x or y coordinate has been passed.  That x and y stuff is actually the same basis that makes an html image map detect where it's been clicked.

Link to comment
https://forums.phpfreaks.com/topic/63353-image-submit-button/#findComment-315769
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.