Jump to content

Need help with validating ISBN 13 Processing Page of PHP program?


Recommended Posts



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" />


I have this so far for my processing page to validate the ISBN 13 number!


function isValidISBN13($isbn)
    $sum = 0;
    for ($i = 0; $i < 13; $i++)
        if ($isbn[$i] === 'X')
            $value = 13;
            $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.



Link to comment
Share on other sites

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.

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.

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.