Jump to content

Swipe card code


m4ttphpnewb

Recommended Posts

If you're wanting them to be removed from the text box rather than PHP replacing them, you're going to have to look at Javascript.  I believe most card readers try to press enter or submit once the card has been scanned, so you could look at some Javascript events for that :)

Link to comment
Share on other sites

ok I have tried a few things with the str_replace() function and can't seem to get it to work with my text box. this is my last thing to fix on my page and it is driving me nuts.(I had to change script to scrip t to post it in the forum)

  $fullname =  str_replace('%','',$fullname) ;
$fullname =  str_replace('?','',$fullname);
echo "               <input type='text' name='left_fullname' id='textbox1' >
	<scrip t>document.getElementById('textbox1').focus()</scrip t>\n";
if (!$fullname) {
            echo "    <td align=left class=right_main scope=col>\n";
            echo "      <table width=100% height=100% border=0 cellpadding=10 cellspacing=1>\n";
            echo "        <tr class=right_main_text>\n";
            echo "          <td valign=top>\n";
            echo "<br />\n";
            echo "You have not chosen a username. Please try again\n";
            include 'footer.php';
            exit;
        }
@$fullname = addslashes($fullname);

 

 

Link to comment
Share on other sites

Ok then, go to the part of your page where you process the submission.

 

Then you can remove the % and ? by doing this:

 

$fullname=$_POST['left_fullname'];
$fullname=  str_replace('%','',$fullname) ;
$fullname =  str_replace('?','',$fullname);

 

That'll remove all % and ? within the textbox after it's submitted, and then you can insert/update your database :)

Link to comment
Share on other sites

It's just what card readers usually do I'm afraid.  They automate Enter I think once they've finished swiping, which is what will be submitting the form (probably the first submit button too).  There may be a setting that you can change on the card reader though - so that it doesn't auto submit.

Link to comment
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.