Having trouble getting this to compile. My error message says in line 42 expected ';" before "text" any suggestions?

#include <iomanip>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <ctype.h>
using namespace std;

struct FORM
{
    string name;
    string data;
};

void getFormData(string, FORM []);
//FORM *create_array(int);
//string param(string, FORM *dyn_array);
string param(string, FORM *);

int main()
{
        
         

string qs(getenv("QUERY_STRING")); 
cout << "Content-type:text/html\n\n"; 


//FORM *dyn_array;
FORM dyn_array[10];    
getFormData(qs, dyn_array); 

string firstname = param("firstname", dyn_array);
string lastname = param("lastname", dyn_array);

cout << "Content-type:text/html\n\n";
cout <<  "<html>" << endl;
 cout << "<body>" << endl;

cout << "<form>" << endl;
cout << "First name: " << endl;
cout << "<input type="text" name="firstname"> " << endl;
<br>
cout << "Last name: " << endl;
cout << "<input type="text" name="lastname"> " << endl;
cout << "</form> " << endl;

cout << "</body> " << endl;
cout << "</html> " << endl;

system("PAUSE");
    return EXIT_SUCCESS;
}

>>cout << "<input type="text" name="firstname"> " << endl;
That line is ill-formed. count the quotes and you will find that the word text is NOT within quotes.
This is probably what you want

cout << "<input type=" << text << " name=" << firstname << "> " << endl;

>>cout << "<input type="text" name="firstname"> " << endl;
That line is ill-formed. count the quotes and you will find that the word text is NOT within quotes.
This is probably what you want

cout << "<input type=" << text << " name=" << firstname << "> " << endl;

I think he rather wants to escape the first quote's since there is no variable text and in HTML wouldn't it make a whole lot of sense to make varaible's on that place differ from time to time. To is differing of the formname's in HTML a bad idea. If you want to send the name with it in the form use hidden fields or something.

cout << "<input type=\"text\" name="firstname"> " << endl;

I think that's what you want

BTW, in HTML I thought it was better to end your input thing's with />, so that would make <input type="text" name="lol" />
If you wanted to set the textfield to the firstname it would be:
<input type="text" name="firstname" value="Default value, you should cout the firstname then here" />

Be a part of the DaniWeb community

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