jameshay Posted May 2, 2014 Share Posted May 2, 2014 HI, I am a beginner at programing and I have to do this project where it is asking me to validate any ISBN 13 number. I know how to set up the input page, but I am having or you could say no Idea how to validate a number if user inputs data in the input page. I have some could below that I think it should be included, but if someone has better way to do it then I would be appreciate it. here is the input page code: <form method="POST" action="Process_isbn13.php"> <p>Enter the ISBN 13: <input type="text" name="isbn13"/></p> <input type="submit" name="Submit" value="Submit" /> </form> I have this so far for my processing page to validate the ISBN 13 number! <?php function isValidISBN13($isbn) { $sum = 0; for ($i = 0; $i < 13; $i++) { if ($isbn[$i] === 'X') { $value = 13; } else { $value = $isbn[$i]; } $sum += ($i + 1) * $value; } } ?> I know there should be more like if it is empty it should say it's empty do it again and if it is not validate then it would say that. The most important thing I need is the code so if i enter a validate ISBN 13 number it would say it's validate! Someone please help me with the code needed to check if ISBN 13 number is validate. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted May 2, 2014 Share Posted May 2, 2014 Help you how? What's your question? No offense, but as far as I can tell, you didn't do anything except copy and paste my code. But that was for ISBN-10, so it's useless here. Do you understand how the ISBN-13 check digit works? I mean the general logic, not the code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.