Jump to content

Using Image As Submit Button


justlukeyou

Recommended Posts

Hi,

 

I have changed it to the following code but it still doesn't work.  Do I need to change the second piece to post_image?

 

if (isset($_POST['image_x'], $_POST['image.x'])) {
    $membername = mysql_real_escape_string(trim($_POST['membername']));

 

<form action="" method="post">
    <?php if($error) echo "<span style=\"color:#ff0000;\">".$error."</span><br /><br />"; ?>
    <label for="membername">Username: </label> <input type="text" name="membername" value="<?php if($_POST['membername']) echo $_POST['membername']; ?>" /><br />
    <label for="password">Password: </label> <input type="password" name="password" value="<?php if($_POST['password']) echo $_POST['password']; ?>" /><br />
    <label for="password2">Retype Password: </label> <input type="password" name="password2" value="<?php if($_POST['password2']) echo $_POST['password2']; ?>" /><br />
    <label for="email">Email: </label> <input type="text" name="email" value="<?php if($_POST['email']) echo $_POST['email']; ?>" /><br /><br />
  <input type="image" value="submit" name="image" src="http://www.ukhomefurniture.co.uk/images/homepageregister.PNG"  >

$_POST['image.x'] doesn't exist and won't ever be set. From the link I posted -

Because foo.x and foo.y would make invalid variable names in PHP, they are automagically converted to foo_x and foo_y. That is, the periods are replaced with underscores. So, you'd access these variables like any other described within the section on retrieving variables from external sources. For example, $_GET['foo_x'].

 

All you need to use is -

 

if(isset($_POST['image_x'])){

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.