0

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?

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


<html>
<head>
<title>Book Cover Viewer</title>
</head>

<body>
<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>
</form>
</body>

</html>
4
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by codejoust
0

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` :)

0

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; } ?>" />

Edited by almostbob: n/a

0

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>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.