I am having a problem with my input line for ISBN numbers

I want the user to input an ISBN number into the blank and after submit is hit and the page refreshes I would like the ISBN entered to still be listed inside of the textbox

can someone please help me? I have searched the internet and the examples i have found did not work for me?

	$ISBN = $_POST['ISBN'];
	$EFFECT = $_POST['effect'];
	$SIZE = $_POST['size'];
	echo "<img src='http://images.amazon.com/images/P/$ISBN.01._$EFFECT\ _$SIZE\ _.jpg'>";

<title>Book Cover Viewer</title>

<form method="POST" action="amazon.php">
ISBN (10 digits with no spaces): 
<input type="text" name="ISBN" size="20" value=""></input>(ex: 0672326973)<br><br><br>
Would you like a shadow or a border on your book cover?<br>

Shadow (right) <input type="radio" name="effect" value="PA10,15,15,10"><br>
Shadow (left) <input type="radio" name="effect" value="PB10,15,15,10"><br>
Border (thin and blue)<input type="radio" name="effect" value="BO1,0,0,255"><br>
Border (medium and green)<input type="radio" name="effect" value="BO5,0,255,0"><br>
Border (thick and red)<input type="radio" name="effect" value="BO10,255,0,0"><br>
No effects<input type="radio" name="effect" value="oooo"><br><br><br>

How big would you like the image to be?<br>
Small<input type="radio" name="size" value="SCTZZZZZZZ"><br>
Medium<input type="radio" name="size" value="SCMZZZZZZZ"><br>
Large<input type="radio" name="size" value="SCLZZZZZZZ"><br><br><br>

<input type="submit" name="submit" value="submit"><br>


Recommended Answers

All 3 Replies

well for one you shouldn't be doing <input></input> but rather <input /> or <input> for XHTML and HTML respectively (you can do the former in HTML also; and it's considered good practice)

I would recommend using cookies, and then if a cookie is already stored then display it in the text box (done by using the value attribute)

That approach may require JavaScript though;

Hope I've helped, Craig` :)

similarly to the way the $_post data is already accessed
ISBN is already defined in the php scrap above, so you can access it

ISBN (10 digits with no spaces): 
<input type="text" name="ISBN" size="20" value="<?php if($ISBN) { echo $ISBN; } ?>" />

You can typically focus an textarea using:

<script type='text/javscript'>setTimeout("document.getElementById('focus').focus();",5);/*Set input focus, timeout as a faux document.ready*/</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.