Solved

keeping data in cells

Posted on 2008-06-13
14
194 Views
Last Modified: 2010-04-09
Hello ... i have a form in some.html which is a pain in the a** ... after it`s submitted, if the fields weren`t completed correctly some script returns you to the form ... but with all the fields cleared. So i need something that keeps that info there after. Can someone help me please ?! .. thanks
0
Comment
Question by:milionnzaru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
14 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 21777735
You need to populate the cells with content.  Typically this requires server-side scripting.  What language are you using to process your form input on the server?
0
 

Author Comment

by:milionnzaru
ID: 21777785
:) here's what i'm using (hope this is what u asked 4) :
<form method="post" action="some.php" name="name">
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 21777796
you should echo your variables in input fields like
<input type="text" name="some_name" value="<?php echo $some_name ?>">
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 21777845
The data in your form will arrive in the action script in an associative array called $_POST.  Please abide by all the usual caveats about filtering input - you MUST NOT trust the contents of $_POST.  There are bad guys out there on the internet who will destroy your data base just for fun if you don't filter the input.

That said, here is a general example:
<?php // RAY_post.php
if ($_POST["instring"] != '') {
	extract ($_POST);
	echo "<br />You posted $instring \n";
}
?>
 
<form method="post" action="<?=$PHP_SELF?>">
<br />Post here:<input type="text" name="instring" value="<?=$instring?>" />
<input type="submit" value="Go" />
</form>

Open in new window

0
 

Author Comment

by:milionnzaru
ID: 21777944
that didn`t work :(
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 21777984
Can you please post your code ?So than we can implement in it...
0
 

Author Comment

by:milionnzaru
ID: 21778005
i have 5 fields named field1 field2 ....
can u write the code exactly so i can use it very easy ?! i`m a beginner sorry if i give u head-aches :)
because i didn`t understand the code u wrote ... just tried this :
value="<?php echo $sa ?>" and nothing ..:(
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 21778058
$field1 = $_POST['field1'] ;
<input type="text" name="field1" value="<?php echo $field1 ?>">

        The logic in here is that ; when you post the page all of the inputs will be send to post array with their names and you can reffer them by thier names like ; $_POST['type_input_name_here'] ;
      May be it might help you to understand it better if you first try to test it with a string instead of variable like ;
    <input type="text" name="field1" value="Field 1 value goes here">
    The statment above will write Field1 value goes here text inside the inputbox if you test it.
     
    So that means we can dynamically print our variable in there as i wrote above...
0
 

Author Comment

by:milionnzaru
ID: 21778108
the inputs are already defined like u said ... the problem is that that echo doesn/t work
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 21778172
If you send your code it would be easier to debug, but generally the form should look like that ;
##################some.php#################### <<< The file name that you should save as..
<form action="some.php" method="post">
<input type="text" name="field1" value="<?php echo $_POST['field1'] ?>">
<input type="submit" value="send">
</form>

    In first time that you call page ,there wont be any values inside field1 as we know, whenever you type something in field1 and click submit it should echo the value...
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 21778179
##################some.php#################### <<< The file name that you should save as..
  From the line above i mean your file name should be some.php
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 21781332
milionnzaru: The code I posted runs.  You can see it in action here: http://www.laprbass.com/RAY_post.php

What language are you using in your action script?  Is it PHP?  Please post the action script.

If the echo() command does not work, there is something seriously wrong with your installation of PHP!!

Standing by, ~Ray
0
 

Author Comment

by:milionnzaru
ID: 21789294
the solution was very simple ray ... the echo works but first i was writing it wrong ... thanks a lot
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Table style position to the left 8 26
null, truthy, falsey confusion 25 33
How do I split a variable to newline 2 19
HTML CSS and  Table design 4 11
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question