Please tell me how I got the following wrong:-

<form name="GetTicket" id="GetTicket" method="post" action="Winner.php?Event="<?php echo $Event ?>">
<table border="1" frame="box" cellpadding="3" align="center" width="300">
<tr><td align=left>Ticket Number</td>
<td colspan="2" width=65%>
<input type="submit" style="width:0px;height:0px;border:none">
<input type=text name="TicketNumber" id="TicketNumber" value=<?php echo $TicketNumber ?> >
</td></tr>
<tr><td align=left>Member Number</td>
<td align=left><input type="text" readonly name=MemberNommer id=MemberNommer value=<?php echo $MemberNommer ?> ></td></tr>
<tr><td align=left>Member Name</td>
<td align=left><input type="text" readonly value=<?php echo $Naam ?> ></td></tr>

The TicketNumber displays fine but neither the MemberNommer nor Naam display even though I have proved that the php variables contain valid data.

Dani AI

Generated

and were on the right track: the problem is in the generated HTML, not in PHP logic. Browsers only accept unquoted attribute values in very limited cases; if a variable contains spaces or characters like &, <, > or quotes, the attribute will be broken and the value will not appear in the control. See the HTML attribute rules for details (HTML attribute syntax).

Practical fixes that avoid broken markup and cross-site issues: always emit attribute values inside quotes and escape content for the HTML context before echoing it. In PHP, use htmlspecialchars to encode characters that would break an attribute, and use urlencode when inserting data into a query string (form action). Those steps keep the rendered HTML valid and prevent accidental truncation or injection (htmlspecialchars, urlencode).

Troubleshooting checklist: view the page source or use DevTools to inspect the generated input elements and the form action; run the page through the W3C validator to find parse errors (W3C Markup Validation Service); temporarily echo the raw variable values outside inputs to confirm their runtime contents. After quoting and escaping, the MemberNommer and Naam fields should render correctly; if not, paste the generated HTML (not the PHP) for further diagnosis.

Recommended Answers

All 2 Replies

I could be wrong but i think u have to put the quotation marks in

<input type="text" readonly name=MemberNommer id=MemberNommer value="<?php echo $MemberNommer ?>" />

I dont know php, so i m not sure if the double quotes will break the php code.

All attributes of the type attribute="argument" now need quotes around the arguments. PHP knows this.

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.