i have:
<a href="/patients/#{@appointment.patient.id}">
<%=h @appointment.patient.f_name %> <%=h @appointment.patient.l_name%>
</a>
but it dose not work due to a syntax error, if i click on the href it goes to http://0.0.0.0:3000/patients/#{@appointment.patient.id}
thanks
href”, append the variable to it (Here we have used a variable named “XYZ”). Then we need to append the value to the URL. Now our URL is ready with the variable and its value appended to it. In the example below, we will append a variable named 'XYZ' and its value is 55.
<input type="text" name="example"> <? php $ex = $_REQUEST['example']; ?> <a href="http://example.com/number=<;?php $ex ?>"> it only show http://example.com/number= how to fix it so the $ex will be combine with link ? Try to echo the variable value.
You can do:
<a href="/patients/<%= @appointment.patient.id %>">
But it's generally easier to use link_to
:
link_to(@appointment.patient.f_name + " " + @appointment.patient.l_name,
:controller => 'patients', :action => 'show', :id => @appointment.patient.id)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With