Learning HTML, wanting to code a CGI in C, to send HTML that includes a form text box, as in
I know how to send out an empty box, and I can send a string hardcoded that will show up in the box, but how to get it to display in the box a text string that's
generated on the fly from somewhere else, so I can't just code it in directly?
I'm a student, and this is for a project, a database on the teacher's server, available to users from a remote client browser. I've got it so I can code for queries and
selects and return what I want in a series of CGI's. But I want an administrator to be able, from a remote machine, to call up one record from the database, each field
in its own box, and edit it if he wants to, and submit it back to the database, with the proper insert statements in SQL.
The server, by the way, is Linux, with MySQL database.
I'm sure I can use the sprintf thing, with %s followed by a substitute string. In playing with it I actually saw the data land in the form box one time, and I thought Ha,
that's it!! And I went on and added code to make a bunch more boxes for the other data fields. When I went to run the expanded CGI, all the boxes came up empty.
In struggling with it I lost track of exactly what I wrote that worked that one golden time. I already can get the data into a string pointer temp, and can just display it
straight in HTML, and it prints to the browser screen fine, so I know the data is in the pointer at this point in the code. But how to get it into the box???
printf("input type=text name=fred value="%s", temp>");
I'm sure the "%s", part is right, but how to deal with substituting in the temp for the %s?? I've tried every possible combination of quotes and slashes and anything I
can think of, and it drives me crazy that I've seen it work once, just once.