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
https://forums.phpfreaks.com/topic/90968-swipe-card-code/#findComment-466256
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
https://forums.phpfreaks.com/topic/90968-swipe-card-code/#findComment-467014
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
https://forums.phpfreaks.com/topic/90968-swipe-card-code/#findComment-467076
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
https://forums.phpfreaks.com/topic/90968-swipe-card-code/#findComment-467094
Share on other sites

hahah I will beat the card reader! (against the wall till it stops auto entering) nope I will work  on a work around and post back when I have  out smarted  the little piece of hardware, thanks for helping me out so much  Im beginning to feel my way around the code much better ;D

Link to comment
https://forums.phpfreaks.com/topic/90968-swipe-card-code/#findComment-467097
Share on other sites

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.